11. Adaptive Text Height
1 nsdictionary *attributes = @{nsfontattributename: [uifont systemfontofsize:]}; 2 3 CGRect rect = [Text Boundingrectwithsize:cgsizemake (Viewwidth, maxfloat) options: Nsstringdrawinguseslinefragmentorigin attributes:attributes Context:nil]; 4 5 return rect.size.height;
IOS9 Adaptation Settings
In fact, in Xcode 7, when we create a new iOS program, the Bitcode option is set to Yes by default. We can see this setting in the "Build Settings", "Enable bitcode" option.
Either let the third-party library support or turn off the target's bitcode option.
IOS9 HTTPS to HTTP
1 <key>NSAppTransportSecurity</key> 2 3 <dict> 4 5 <!--Connect to anything ( This was probably bad)-- 6 7 < Key>nsallowsarbitraryloads</key> 8 9 <true/> One </dict>
14. Intercepting strings
[Str substringfromindex:6];
Substringwithrange:nsmakerange (4,2) intercepts a portion of a string, starting with the 4th bit, intercepting two-bit
substringtoindex:n Intercept to the first few
The (substringfromindex:n) string is intercepted from the nth bit until the last
16.nsscanner:nil string argument
The reason for the error is that when we call a method, we pass in an empty string (note that the string content is empty) as a method parameter.
I get a string of data from the server, considering that some objects do not contain this string variable, I use the first to determine whether the string is empty, for example:
Suppose that this string is called STR,
First determine if (Str!=nil) {
Do something
Double Data=[str Doublevalue];
}
However, when the data is empty, the error is still
The official Apple document has such a code:
- ID avalue = [arraywithnull objectatindex:0];
- if (Avalue = = nil) {
- NSLog (@ "equals nil");
- } else if (avalue = = [NSNull null]) {
- NSLog (@ "equals NSNull instance");
- if ([Avalue Isequal:nil]) {
- NSLog (@ "Isequal:nil");
- }
- }
- Output: "Equals NSNull instance"
Although finally my problem solved, I in the If Judgment with
- if (![ Tmpnewsmodel.latitude isequal:[nsnull Null]]) {
- Do something
- }
The problem is solved, but not quite understand the difference between nil and nsnull?
17.iphone size
18. Modify the Mac host file
sudo nano/etc/hosts
The same is the input password, open the Hosts file, according to your needs to edit the file, after editing, press Ctrl+o Save,
When the File Name to Write:/etc/hosts, press ENTER to confirm, and then press Ctrl+x to exit.
IOS8 set TableView Separatorinset Split line start from the top of the border
The following methods have been tested to work correctly on iOS7 8
1-(void) Viewdidlayoutsubviews2 3 {4 5 if([Self.tableview respondstoselector: @selector (setseparatorinset:)]) {6 7[Self.tableview Setseparatorinset:uiedgeinsetsmake (0,0,0,0)];8 9 }Ten One A - if([Self.tableview respondstoselector: @selector (setlayoutmargins:)]) { - the[Self.tableview Setlayoutmargins:uiedgeinsetsmake (0,0,0,0)]; - - } - + } - + A at-(void) TableView: (UITableView *) TableView Willdisplaycell: (UITableViewCell *) cell Forrowatindexpath: (Nsindexpath *) Indexpath - - { - - if([Cell Respondstoselector: @selector (setseparatorinset:)]) { - in [Cell Setseparatorinset:uiedgeinsetszero]; - to } + - the * if([Cell Respondstoselector: @selector (setlayoutmargins:)]) { $ Panax Notoginseng [Cell Setlayoutmargins:uiedgeinsetszero]; - the } + A}
20.url can not have Chinese characters, need to convert no will request error
Issues and solutions for iOS writing projects (2)