1. Use Mjrefresh to pull up small details
Mjrefreshbackgiffooter *footer = [Mjrefreshbackgiffooter footerwithrefreshingblock:^{ [_ Searchresultview.mj_footer endrefreshing]; // Loading New content [self loadmoreitemlist];}];
The effect of this writing is that when the current pull load, the new content is not directly displayed, you have to continue to pull up to see the new content
When a different way of writing, the endrefreshing written in loadmoreitemlist, the effect is not the same
Mjrefreshbackgiffooter *footer = [Mjrefreshbackgiffooter footerwithrefreshingblock:^{ //Loading New content[self loadmoreitemlist];}];-(void) loadmoreitemlist{//The rest of the code ...//Stop Refresh if(_searchresultview.mj_footer.state = =mjrefreshstaterefreshing) { if(Arrtemp.count >0) {[_searchresultview.mj_footer endrefreshing]; } Else{[_searchresultview.mj_footer endrefreshingwithnomoredata]; } }}
This effect is much better, the emergence of new content direct display, and do not need to drag on to know that there is new content, experience is better.
Although it is a matter of detail, the experience will be different.
2. When drawing a Bezier curve, the following two representations differ
Uibezierpath *bezierpath = [Uibezierpath bezierPathWithOvalInRect:view.bounds];
Bezierpathwithrect a curve based on a rectangular drawing
Bezierpathwithovalinrect curve based on a rectangular inscribed circle
3. If there is a need, in the app, an interface is displayed only when the user first launches each day, so the idea is to get the current time, and then compare it with the time stored in nsuserdefaults, if it is the same date, and vice versa.
nsuserdefaults *user = [nsuserdefaults Standarduserdefaults]; NSString *timestorage = [user Objectforkey:@ " signtime " ]; NSDate *senddate = [NSDate Date]; NSDateFormatter *dateformatter = [[NSDateFormatter alloc] init];[ Dateformatter Setdateformat: @ " YYYY-MM-DD " ]; NSString *timenow = [dateformatter stringfromdate:senddate]; if (! [timenow Isequaltostring:timestorage]) { // description is the first time that the } was started on the same day
The above method is a bit problematic, if it involves multi-account problems, such as changing account login, then the second account even if the first login, will not show.
The workaround is to store the time to Nsuserdefaults, and key turns the signtime in the example into a user ID.
4. Draw the dashed line, can use DrawRect, also can use the Cashapelayer, relative, the latter's use scope is more extensive, can write in the view, also can write to the controller.
Take Cashapelayer as an example, you need to use Setlinedashpattern to set the dash line width and spacing
Cashapelayer *shapelayer =[Cashapelayer layer]; [Shapelayer SetBounds:lineView.bounds]; [Shapelayer setposition:cgpointmake (LineView.frame.size.width/2.0, LineView.frame.size.height)]; [Shapelayer Setfillcolor:[uicolor Clearcolor]. Cgcolor];//Set Dash color[Shapelayer Setstrokecolor:[uicolor Lightgraycolor]. Cgcolor];//set the dash width[Shapelayer setLineWidth:lineView.frame.size.height];//Set line width and spacing for dashed lines[Shapelayer setlinedashpattern:[nsarray arraywithobjects:[nsnumber Numberwithint:5], [NSNumber numberwithint:5], nil]]; Cgmutablepathref Path=cgpathcreatemutable (); Cgpathmovetopoint (Path, NULL,0,0); Cgpathaddlinetopoint (Path, NULL, LineView.frame.size.width,0); [Shapelayer Setpath:path]; Cgpathrelease (path); [Lineview.layer Addsublayer:shapelayer];
The effect is as follows:
5. Bottom navigation bar Tabbar's Click Proxy method, click on the serial number can get the previous and now clicked
-(BOOL) Tabbarcontroller: (Uitabbarcontroller *) Tabbarcontroller Shouldselectviewcontroller: (UIViewController* ) Viewcontroller { // now clicked nsuinteger selectednum = [ Tabbarcontroller.viewcontrollers Indexofobject:viewcontroller]; // previous Nsuinteger selectedindex = tabbarcontroller.selectedindex;}
6. Get the cell display on the viewable area of the screen, and you can use
The ①uitableview method, which is the most straightforward, returns an array of UITableViewCell.
-(nsarray*) visiblecells;
②uitableview another way to return an array of Nsindexpath, you can directly use Indexpath.row to adjust the data in the table. More convenient for self-customizing cell
-(nsarray*) indexpathsforvisiblerows;
③ gets the frame within index
-(CGRect) Rectforrowatindexpath: (nsindexpath*) Indexpath;
7. Determine if the controller is present on the current screen, which appears in the visible area and can be used in the controller
self.isviewloaded && Self.view.window to judge.
can also be added to the controller's category
+ (BOOL) iscontrollervisible: (Uiviewcontroller *) controller{ return[controller.isviewloaded && Controller.view.window];}
Because when the controller's view is displayed, the View.window must not be null.
iOS work notes (15)