1. How to set the font size of button title by code
Set Button.titleLabel.font = [Uifont systemfontofsize:<# (CGFloat) #>];
2. Get the current time
NSDate *timedate=[nsdate Date]; * Dateformatter=[[NSDateFormatter alloc] init]; [Dateformatter Setdateformat: @" yyyymmddhhmmsssss " ]; *locationstring=[dateformatter Stringfromdate:timedate];
3. The method of judging whether the string is a null character
-(BOOL) isblankstring: (NSString *)string { if(string= = Nil | |string==NULL) { returnYES; } if([stringIskindofclass:[nsnullclass]]) { returnYES; } if([[stringStringbytrimmingcharactersinset:[nscharacterset Whitespacecharacterset]] length]==0) { returnYES; } returnNO;}
4, TableView optimization
// Refresh the entire table [_tableview reloaddata]; // refreshes the current row [_tableview Reloadrowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationautomatic];
5, Baidu map Custom pin image
-(Bmkannotationview *) Mapview: (Bmkmapview *) View viewforannotation: (ID<BMKAnnotation>) annotation{//generate reuse Flag identifier StaticNSString *annotationviewid =@"Annotationviewid"; //Check if there is a reuse cachebmkannotationview* Annotationview =[view Dequeuereusableannotationviewwithidentifier:annotationviewid]; ((Bmkpinannotationview*) annotationview). Pincolor =Bmkpinannotationcolorgreen; Annotationview.image= [UIImage imagenamed:@"Xxx.png"];}
6. The screen size required for IOS app shelves
640*960, 640*1136, 750*1334, 1242*2208
7. The size of the IOS APP icon
58*58, 80*80, 120*120, 180*180
8.
Apple Account Application: This is the method of application: Http://jingyan.baidu.com/article/0320e2c1d153161b87507bba.html This is the official website: https:// developer.apple.com/enroll/organization/
9. Turn off the timer
[_mytimer invalidate];
_mytimer = nil;
10, keyboard release first response
-(BOOL) Textfieldshouldreturn: (Uitextfield *) TextField {
[TextField Resignfirstresponder];
return YES;
}
11, click UITableViewCell, no click Effect,
In the Cellforrowatindexpath: method, write the
Cell.selectionstyle = Uitableviewcellselectionstylenone;
12, the object returned using Nsjsonserialization, depending on what the outermost is, if {} that is the dictionary, [] that is the array, etc.
13, only support vertical screen, modify the Info.plist file can be. Find "Supported interface orientations" to set the item item to portrait. This setting is the global setting.
14. iOS Development
First frame, post-draw interface, write function, write interface, debug, write adaptation
IOS Development Documentation Flowchart UI Framework interface feature adaptation test changes
IOS Junior Development Engineer C Language Foundation +swift Language Foundation
Intermediate iOS Development Engineer iOS project development +ui part + animated layers section
15, the Viewcontroller life cycle of the method execution process is as follows:
init->loadview->viewdidload->viewwillapper->viewdidapper->viewwilldisapper->viewdiddisapper- >viewwillunload->viewdidunload->dealloc
16, GCD
1) Run the main queue in the main thread, obtained through Dispatch_get_main_queue.
2) Parallel queue Global dispatch queue, obtained by Dispatch_get_global_queue, creates three different priority dispatch queues by the system. Parallel queues are executed in the same order as they join the queue.
3) Serial queue serial queues is typically used to synchronize access sequentially, creating any number of serial queues that are concurrent between each serial queue.
17, the Xcode project we often encountered because of the empty data (the data returned by the server through Jsonkit resolution to the like) caused a memory leak and then the program crashes, this in the previous school was a lot of times, so it is necessary to encapsulate a non-empty processing class, due to limited capacity, Look at some of the information on the Internet and think of it in a recursive way.
Solution: A foreigner already in the Githud has the empty processing artifact: Https://github.com/nicklockwood/NullSafe, as long as the category to join the project will be all worry-free, because the code I also do not understand, So let's study the ha.
18. Read Plist file
NSString *filepath = [[NSBundle mainbundle] pathforresource:@ "provinces.plist" oftype:nil];
Nsarray *arr = [Nsarray Arraywithcontentsoffile:filepath];
//Loading plist data//a NSBundle object corresponding to a resource bundle (Pictures, audio, video, Plis, etc.)//nsbundle function: Used to access the corresponding resource bundle within the file, can be used to obtain the full path of the file//the resources added to the project will be added to the Master resource bundle//[NSBundle Mainbundle] is associated with the project's Master resource bundleNSBundle*bundle =[NSBundle Mainbundle]; //using Mainbundle to obtain the full path of the plist file in the Master resource bundleNSString *file = [Bundle Pathforresource:@"Shops"OfType:@"plist"];//nsstring *file = [Bundle pathforresource:@ "Shops.plist" oftype:nil]; //All parameters are named file and pass through the full path of the files.Shopsarray = [Nsarray arraywithcontentsoffile:file];
19, lazy loading: When used to load, but also only load once
(1). Lazy Loading Basic
Lazy Loading--also known as deferred loading--is loaded when needed (low efficiency, small memory footprint). The so-called lazy load, write is its get method.
Note: If it is lazy loading, it is important to be aware of whether there is already, if not then to instantiate
(2). Benefits of using lazy loading:
Benefit One: The code that does not necessarily create the object is all written in the Viewdidload method, the code is more readable
Benefit two: Each control's Getter method is responsible for the respective instantiation processing, the code is independent of each other, loosely coupled
IOS trivia point (continuous update)