Objective
This article documented the small knowledge points encountered in the development of iOS, as well as some tips, the following words not to say, to see the detailed introduction.
Tips 1:uibutton pictures and text by default is left and right, how to achieve the left-and-right arrangement?
Solution Tips:
Button.transform = Cgaffinetransformmakescale ( -1.0, 1.0);
Button.titleLabel.transform = Cgaffinetransformmakescale ( -1.0, 1.0);
Button.imageView.transform = Cgaffinetransformmakescale (-1.0, 1.0);
Tip 2: Set navigation bar transparency, title and Barbuttonitem opaque
[Self.navigationController.navigationBar setbackgroundimage:[uiimage new] forbarmetrics:uibarmetricsdefault];
Self.navigationController.navigationBar.translucent = YES;
Tip 3: Set the navigation bar Without Borders
Self.navigationController.navigationBar.shadowImage = [UIImage new];
Tip 4: Hide and display with the scrolling navigation bar of the view (one code)
Self.navigationController.hidesBarsOnSwipe = Yes;
Tip 5: Simple and easy to get the current time stamp
Time stamp
time_t now;
Time (&now);
NSLog (@ "---%ld", now);
Tip 6: Set only the upper-left corner of the UIView and the rounded corner of the upper-right corner (four rounded corners can be selected)
UIView *blueview = [[UIView alloc] Initwithframe:cgrectmake (MB, MB)];
Blueview.backgroundcolor = [Uicolor bluecolor];
[Self.view Addsubview:blueview];
/* Set the enumeration parameter for fillet position
uirectcornertopleft = 1 << 0,
uirectcornertopright = 1 << 1,
Uirectcornerbottomleft = 1 << 2,
uirectcornerbottomright = 1 << 3,
uirectcornerallcorners = ~0UL
*/
Uibezierpath *maskpath = [Uibezierpath bezierPathWithRoundedRect:blueView.bounds byroundingcorners: ( Uirectcornertopleft| Uirectcornertopright) Cornerradii:cgsizemake (20.0, 20.0)];
Cashapelayer *masklayer = [Cashapelayer layer];
Masklayer.frame = blueview.bounds;
Masklayer.path = Maskpath.cgpath;
BlueView.layer.mask = Masklayer;
Tip 7: Prevent users from copying cuts after loading UIWebView
The controller implements this method
-(BOOL) Canperformaction: (SEL) Action Withsender: (ID) sender
{
if (action = = @selector (copy:) | |
action = = @selector (paste:) | |
Action = = @selector (cut:))
{return
NO;
}
return [Super Canperformaction:action Withsender:sender];
}
Tip 8: Jump controller Hide Tabbar a once and for all
Create a NAV base class rewrite Pushviewcontroller: The method is as follows:
-(void) Pushviewcontroller: (Uiviewcontroller *) Viewcontroller animated :(BOOL) Animated {
viewcontroller.hidesbottombarwhenpushed = YES;
[Super Pushviewcontroller:viewcontroller animated:animated];
}
Summarize
The above is the entire content of this article, I hope this article of these tips for your iOS developers can help, if you have questions you can message exchange. Small series will also be updated on the iOS related skills of the article, please continue to focus on the cloud habitat community.