iOS Development--full project in combat OC & Fourth day of best sister Morning One: Custom buttons use nine grid layoutTwo: Controls cannot be clickedThree: Get the user clicked on that buttonFour: Adjust the position of the button internal control: Mainstream-"up and Down"V: Cannot get navigation controller directly using Self.navigationcontroller or viewmethod One:Method Two: Six: Layout rounding
1 //total number of rows2 3 //Nsuinteger rows = sqaures.count/maxcols;4 5 //if (sqaures.count% maxcols) {//not divisible, + 16 7 //rows++;8 9 // }Ten One A //Total Pages = = (total number + Maximum number per page-1)/Maximum number per page -Nsuinteger rows = (Sqaures.count + maxcols-1) /Maxcols; - the
Seven: About picture stretching IB on how to useEight: Tableview-group default down 35: The TableView grouping style is shifted by default by 35 pixels
1 -(void) Setframe: (CGRect) frame { 2 frame.origin.y-= ( Ten ); 3 [Super Setframe:frame]; 4 }
Or: 1 self.tableView.contentInset = Uiedgeinsetsmake (- 0, 0, 0); Nine: Set split line Create n UIView put down the top button left and right-1 plus a picture with split line the best way
/* * * use picture to set split line: You can also use the UIView directly or set the left or right of each button to change a Pixel */-(void ) setup{self.titleLabel.textAlignment = Nstextalignmentcenter; [Self Settitlecolor:[uicolor blackcolor] forstate:uicontrolstatenormal]; Self.titleLabel.font = [uifont systemfontofsize:15 ]; [Self setbackgroundimage:[uiimage imagenamed: @ ' maincellbackground " // Self.backgroundcolor = [Uicolor Orangecolor];
10: Listen to multiple buttons, the user clicks on that one button
Self.subviews Indexofobject:btwself.square[index]
Afternoon 11: Basic steps and processing of network request
1 //Request URL2NSString *requesturl =@"";3 4 //Request Parameters5Nsmutabledictionary *dict =[Nsmutabledictionary dictionary];6dict[@""] =@"";7 8 /** * Send GET request*///__weak typeof (self) weakself = self; Afhttpsessionmanager *manager = [Afhttpsessionmanager manager]; [Manager Get:requesturl Parameters:dict success:^void (nsurlsessiondatatask *data, id responer) {/** * as Return data is empty * /9 if(Responer = =Nil) {Ten One return; } A -} failure:^void(Nsurlsessiondatatask *data, Nserror * error) {/** * Status code after request failed*/ if(Error.code = = nsurlerrorcancelled)return;if(Error.code = = nsurlerrortimedout) { }Else { } - }]; the}
12: Clear cache:(folder does not have a direct size attribute, need to traverse all files to get the size) 1: Cache type 2: Get Cache or encapsulation into categories
1-(Nsinteger) fileSize2 {3 //File Manager4Nsfilemanager *mgr =[Nsfilemanager Defaultmanager];5 //is a folder6BOOL isdirectory =NO;7 //whether this path exists8BOOL exists = [Mgr Fileexistsatpath:self isdirectory:&Isdirectory];9 //path does not existTen if(exists = = NO)return 0; One A if(isdirectory) {//folder - //Total size -Nsinteger size =0; the //get all the content in a folder -Nsdirectoryenumerator *enumerator =[Mgr Enumeratoratpath:self]; - for(NSString *subpathinchenumerator) { - //Get full path +NSString *fullsubpath =[self stringbyappendingpathcomponent:subpath]; - //Get file Attributes +Size + =[Mgr Attributesofitematpath:fullsubpath error:nil].filesize; A } at returnsize; -}Else{//file - return[Mgr Attributesofitematpath:self error:nil].filesize; - } - } -
3: Clean up the cache
1- (void) ClearCache2 {3[Svprogresshud Showwithstatus:@"Clearing Cache"Masktype:svprogresshudmasktypeblack];4 5[[[Nsoperationqueue alloc] init] addoperationwithblock:^{6 [[Nsfilemanager Defaultmanager] Removeitematpath:xmgcachefile Error:nil];7 8[[Nsoperationqueue Mainqueue] addoperationwithblock:^{9[Svprogresshud Showsuccesswithstatus:@"Clear Success"];Ten OneSelf.textLabel.text =Xmgdefaulttext; A - //No Click events -self.userinteractionenabled =NO; the }]; - }]; - } -
13: Thread Communication 14: Implementation cannot be selected, only click 15: Use a different cell depending on the ID 16: File Common parametersFile Size
File Type 17: Common run-time types
- V->void
- :->SEL
- #->class
- @->id
- *->char *
- ?->unknow
- ^type->pointer
Night
iOS Development--full project in combat OC & Fourth day of best sister