今天博主有一些小技巧的需求,遇到了一些困難點,在此和你們分享,但願可以共同進步.css
若是你連下面這些小技巧都還不瞭解,說明你仍是一個菜鳥iOS,看完這篇文章,相信你會成爲一個進階iOSgit
相似這種,我不想讓下面那些空的顯示.github
很簡單. app
self.tableView.tableFooterView = [[UIView alloc] init];
試過的都說好. ide
加完這句以後就變成了這樣.ui
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:img style:UIBarButtonItemStylePlain target:self action:@selector(onBack:)]; self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
self.automaticallyAdjustsScrollViewInsets = NO;
使用IQKeyboardManager(github上可搜索),用完以後腰也不疼了,腿也不酸了. spa
_myTableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);
.net
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.view endEditing:YES]; }
像拉button同樣的拉你的約束.nslayoutattribute也是能夠拉線的. code
navigationController.hidesBarsOnSwipe = Yes;
blog
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];
拉伸圖片的時候怎麼才能讓圖片不變形?
UIImage *image = [[UIImage imageNamed:@"xxx"] resizableImageWithCapInsets:(UIEdgeInsets)];
FlipBoard出品的太適合你了。https://github.com/Flipboard/FLAnimatedImage
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
[self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
繼承uitextfield,重寫這個方法- (void) drawPlaceholderInRect:(CGRect)rect {
[[UIColor blueColor] setFill];
[self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];
}
圖片壓縮小技巧:
http://blog.csdn.net/apple_app/article/details/38847357