iOS development questions (3)

黄舟
Release: 2023-03-05 06:28:02
Original
1176 people have browsed it

22. Solve the messageent to deallocated instance 0x52cc690 error
This error occurs when trying to assign a value to an object, such as:
tfContent.text=bodyText;
At this time, you can open NSZombieEnable option, the console will have the following output:
***-[CFString _isNaturallyRTL]: message sent to deallocated instance 0x52cc690
Explanation The _isNaturallyRTL message was sent to a released object. Judging from the above statement, it may be these two objects: tfContent and bodyText.
You can print the memory address of tfContent or bodyText to see which object has been released:

NSLog(@"tfContent:0x%x",(int) tfContent);
NSLog(@"bodytext:0x%x",(int) bodyText);
Copy after login

The result shows that bodyText was released early:

tfContent: 0x52cf160
bodytext: 0x52cc690
Copy after login

Retain bodyText in the appropriate place and the problem is solved.
23. putpkt:write failed: Broken pipe error
Restart the device.
24. .hfile not found
In fact, the .h file is not included in the target. Select the corresponding .m file, click the "ShowUtilities" button (at the right end of the toolbar), find Target Membership in Utilities, uncheck Target, and then recheck it. That is equivalent to adding the .m file to the Buildphase of the target.
25. Xcode 4: How to convert xib for iPhone to for iPad
In Xcode 3.x, convert xib from iPhone version to iPad version through the Create iPad Version menu.
But in Xcode 4.x, this menu cannot be found. After some exploration, the author found that the xib can be converted to the iPad version using the following method.
1. Modify the xib source file
The xib file is actually an xml file. In Project Navigator, right-click on the xib file and select "Open As -> Source Code". You can view the xib file in source code mode. Find the line "com.apple.InterfaceBuilder3.CocoaTouch.XIB" and change it to " com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB", that is, ".iPad" is added.
Press ⌘+F to open the search bar, click the Replace menu, and change the mode to the replacement mode. Replace all "IBCocoaTouchFramework" in the xib file with "IBIPadFramework".
Press ⌘+S to save changes.
2. Modify the view size of xib
Right-click on the xib file, select "Open As -> Interface Builder – iOS", and open it in IB mode.
Select the root view (UIView) in the xib file, find the Size option in the properties panel, and change it to Full iPad Screen.

Now, you can have an iPad version of xib.

26. icon dimensions (0 x 0) don't meet the size requirements.
Open the Project's BuildSettings, find Compress PNG Files, and set the value to No.
Or:
Select the png file, find the File Type in the FileInspector panel, and change it from "PNG" to "Icon".
27. Warning: noprevious prototype for function
Open Target ->BuildSettings, search for prototype, and change Missing Function ProtoTypes to NO.
28. The error "Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clangfailed with exit code 1" occurs when CorePlot is compiled
Please change the Scheme from iOS Device to iPhone 5.0 Simulator. Or change the Compiler for C/C++ to LLVM GCC4.2. At the same time, Core Plot 1.0 no longer supports older armv6 CPUs.
29. Using CABasicAnimation to change the alpha value of UIView is invalid
The alpha value of UIView is actually "opacity" in CALayer. Please use opcity as the keyPath.
30. CorePlost: After customizing the Axis Label, the Tick Mark is not displayed.
Set the majorTickLocations of Axis to the location where you want to display the tick mark.

NSMutableArray*customTickLocations=[[[NSMutableArray alloc]init]autorelease]; 
for(int i=0;i<10;i++){
[customTickLocationsaddObject:[NSNumber numberWithInt:i]];
}
xAxis.majorTickLocations=[NSSetsetWithArray:customTickLocations];
Copy after login

31. Customized UITableViewCell, indentationLevel cannot take effect
The layoutSubviews method needs to be implemented in the customized UITableViewCell.

- (void)layoutSubviews
{
[super layoutSubviews];
float indentPoints = self.indentationLevel *self.indentationWidth;
for(UIView *view in self.subviews){
view.frame = CGRectMake(
view.frame.origin.x+indentPoints,
view.frame.origin.y,
view.frame.size.width, 
view.frame.size.height
); 
}
}
Copy after login

The above is the content of iOS development questions (3). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!