9: Third-party plugin finishing
JSON to entity: Jsonmodel https://github.com/icanzilb/jsonmodel/Beautification key: BButton https://Github.com/mattlawer/bbuttonStatus bar Tip: jdstatusbarnotification https://github.com/jaydee3/jdstatusbarnotificationPhoto Display plugin: Mjphotobrowser https://Github.com/azxfire/mjphotobrowserSwipe the list line to show more options: Swtableviewcell https://Github.com/cewendel/swtableviewcellPicture View plugin: Mwphotobrowser https://Github.com/mwaterfall/mwphotobrowserScroll bar plugin: Asprogresspopupview https://Github.com/alskipp/asprogresspopupviewTime Processing: Nsdate-helper https://Github.com/billymeltdown/nsdate-helperVarious progress bars: M13progresssuite https://Github.com/marxon13/m13progresssuitePop-up tip mbprogresshud:https://Github.com/jdg/mbprogresshud
10:button display to set different fonts
[_headerfanscountbtn setattributedtitle:[self Getstringwithtitle:@"fans"Andvalue:_curuser.fans_count.stringvalue] Forstate:uicontrolstatenormal]; method (depending on the length to set its different style display):-(nsmutableattributedstring*) Getstringwithtitle: (NSString *) title Andvalue: (NSString *) value{nsmutableattributedstring*attristring = [[Nsmutableattributedstring alloc] initwithstring:[nsstring stringWithFormat:@"%@ %@", title, value]]; [Attristring addattributes:@{nsfontattributename: [Uifont systemfontofsize: the], nsforegroundcolorattributename: [Uicolor Blackcolor]} rang E:nsmakerange (0, Title.length)]; [Attristring addattributes:@{nsfontattributename: [Uifont systemfontofsize: the], nsforegroundcolorattributename: [Uicolor colorwithhexstring:@"0x3bbd79"]} range:nsmakerange (Title.length+1, Value.length)]; returnattristring;}
The Accessorytype property of 11:uitableviewcell
Cell.accessorytype = Uitableviewcellaccessorynone; // the cell does not have any style cell.accessorytype = Uitableviewcellaccessorydisclosureindicator; // There is a small arrow on the right side of the cell, more than 10 pixels from the right;cell.accessorytype = Uitableviewcellaccessorydetaildisclosurebutton; // the cell to the right has a blue circular button; cell.accessorytype = Uitableviewcellaccessorycheckmark; // the shape on the right of the cell is a checkmark;
12:layoutsubviews will be called in the following cases
A, init initialization does not trigger layoutsubviews. B, Addsubview will trigger layoutsubviews. C, set the frame of the view will trigger Layoutsubviews, of course, if the frame value has changed before and after the setting. D, rolling a uiscrollview will trigger layoutsubviews. E, rotate screen will trigger the Layoutsubviews event on the parent UIView. F, changing the size of a uiview will also trigger the Layoutsubviews event on the parent UIView. G, call Setlayoutsubviews directly.
13: Keys for navigation bar (custom picture)
UIButton *settingbtn = [self navbuttonwithimagename:@ "settingbtn_nav" action:@ Selector (settingbtnclicked:)]; = [[Uibarbuttonitem alloc] initwithcustomview:settingbtn]; *ADDUSERBTN = [Self navbuttonwithimagename:@ "adduserbtn_nav" action: @selector ( adduserbtnclicked:)]; = [[Uibarbuttonitem alloc] initwithcustomview:adduserbtn];
14: Custom table row (Inherit UITableViewCell)
@interface Titlerimagemorecell () @property (Strong, nonatomic) UILabel*Titlelabel, @property (Strong, nonatomic) Uiimageview*Usericonview, @end @implementation Titlerimagemorecell-(ID) Initwithstyle: (Uitableviewcellstyle) style Reuseidentifier: (NSString *) reuseidentifier{ Self=[Super Initwithstyle:style Reuseidentifier:reuseidentifier]; if(self) {//Initialization CodeSelf.accessorytype =Uitableviewcellaccessorydisclosureindicator; if(!_titlelabel) {_titlelabel= [[UILabel alloc] Initwithframe:cgrectmake (Kpaddingleftwidth, ([Titlerimagemorecell cellheight]- -)/2, -, -)]; _titlelabel.backgroundcolor=[Uicolor Clearcolor]; _titlelabel.font= [Uifont systemfontofsize: -]; _titlelabel.textcolor=[Uicolor Blackcolor]; [Self.contentview Addsubview:_titlelabel]; } if(!_usericonview) {_usericonview= [[Uiimageview alloc] Initwithframe:cgrectmake ((Kscreen_width-ktitlerimagemorecell_heighticon)- kpaddingleftwidth- -, ([Titlerimagemorecell cellheight]-ktitlerimagemorecell_heighticon)/2, Ktitlerimagemorecell_heighticon, Ktitlerimagemorecell_heighticon)]; [_usericonview Docircleframe]; [Self.contentview Addsubview:_usericonview]; } } returnSelf ;}- (void) layoutsubviews{[Super Layoutsubviews]; if(!_curuser) { return; } Self.titleLabel.text=@"Avatar"; [Self.usericonview Sd_setimagewithurl:[_curuser.avatar Urlimagewithcodepathresizetoview:_usericonview] Placeholderimage:kplaceholdermonkeyroundview (_usericonview)];}+(cgfloat) cellheight{return 70.0;} @end then make the call (you can pass the value of the property and load different rows and their heights in different places):-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{if(Indexpath.section = =0&& Indexpath.row = =0) {Titlerimagemorecell*cell =[TableView Dequeuereusablecellwithidentifier:kcellidentifier_titlerimagemore Forindexpath:indexpath]; Cell.curuser=_curuser; [TableView Addlineforplaincell:cell Forrowatindexpath:indexpath withleftspace:kpaddingleftwidth]; returncell;}Else{Titlevaluemorecell*cell =[TableView dequeuereusablecellwithidentifier:kcellidentifier_titlevaluemore forindexpath:indexpath];}returncell;}
15: When the icon of the button is changed direction
[Self setimage:[uiimage imagenamed:@ "nav_arrow_down"= cgaffinetransformrotate (Self.imageView.transform, Degrees_to_radians ()); // This is going to be 180 degrees to go, down or down
16: Add a control with picture text in the middle of the navigation bar
-(Uidownmenubutton *) Initwithtitles: (Nsarray *) titlelist Anddefaultindex: (nsinteger) Index ANDVC: (UIViewController *) viewcontroller{ Self=[Super Init]; if(self) {_titlelist=titlelist; _curindex=index; _curshowing=NO; _mysuperview=Viewcontroller.view; Self.backgroundcolor=[Uicolor Clearcolor]; [Self Settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal]; [Self Settitlecolor:[uicolor lightgraycolor] forstate:uicontrolstatehighlighted]; [Self.titlelabel Setfont:[uifont systemfontofsize:knavtitlefontsize]; [Self.titlelabel setminimumscalefactor:0.5]; [Self addtarget:self Action: @selector (changeshowing) forcontrolevents:uicontroleventtouchupinside]; [Self Refreshselfui]; } returnSelf ;}- (void) refreshselfui{NSString*titlestr =@""; Downmenutitle*menuobj =[Self.titlelist ObjectAtIndex:self.curIndex]; Titlestr=Menuobj.titlevalue; CGFloat titlewidth= [Titlestr getWidthWithFont:self.titleLabel.font constrainedtosize:cgsizemake (Kscreen_width, -)];//get the width of the textCGFloat btnwidth = Titlewidth +Knavimagewidth; Self.frame= CGRectMake ((kscreen_width-btnwidth)/2, ( -- -)/2, Btnwidth, -); Self.titleedgeinsets= Uiedgeinsetsmake (0,-knavimagewidth,0, Knavimagewidth); Self.imageedgeinsets= Uiedgeinsetsmake (0, Titlewidth,0, -titlewidth); [Self settitle:titlestr forstate:uicontrolstatenormal]; [Self setimage:[uiimage imagenamed:@"Nav_arrow_down"] forstate:uicontrolstatenormal];} Several of these values:#defineKnavtitlefontsize 19#defineKscreen_width [UIScreen mainscreen].bounds.size.width#defineKnavimagewidth (15.0+5.0)and assign it directly to Titleview:uidownmenubutton .*NAVBTN =[[Uidownmenubutton alloc] initwithtitles:titlelist anddefaultindex:index andvc:self]; Navbtn.menuindexchanged=Block; Self.navigationItem.titleView=navbtn; Note: The button is a text with the picture, but the picture is on the left, to the picture and the text by uiedgeinsetsmake the position of the change. Can make a fuss in the navigation bar Titleview, put some other controls, or views;
17: Simple use of the collection view Uicollectionview
to follow three protocols: Uicollectionviewdatasource,uicollectionviewdelegate, Uicollectionviewdelegateflowlayout set the layout of a cell uicollectionviewflowlayout*flowlayout =[[Uicollectionviewflowlayout alloc]init]; [FlowLayout Setitemsize:cgsizemake ( -, -)];//set the cell size[FlowLayout setscrolldirection:uicollectionviewscrolldirectionvertical];//set its layout directionFlowlayout.sectioninset = Uiedgeinsetsmake (5,5,5,5);//set its bounds//its layout is interesting, when your cell is set to size, how many cells are in a row, determined by the cell's widththen set the collection view: _collectionview= [[Uicollectionview alloc]initwithframe:cgrectmake (0,0, the, Self.view.frame.size.height) collectionviewlayout:flowlayout]; _collectionview.datasource=Self ; _collectionview.Delegate=Self ; _collectionview.backgroundcolor=[Uicolor Clearcolor]; [_collectionview Registerclass:[bmcollectioncellclass] forcellwithreuseidentifier:cell_id]; [Self.view Addsubview:_collectionview]; Note: Other delegate events not fully written, such as Numberofsectionsincollectionview, etc.;
iOS Client Coding Project record (ii)