今天博主有一些小技巧的需求,遇到了一些困难点,在此和大家分享,希望能够共同进步.
如果你连下面这些小技巧都还不了解,说明你还是一个菜鸟iOS,看完这篇文章,相信你会成为一个进阶iOS
类似这种,我不想让下面那些空的显示.
很简单.
self.tableView.tableFooterView = [[UIView alloc] init];
试过的都说好.
加完这句之后就变成了这样.
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上可搜索),用完之后腰也不疼了,腿也不酸了.
_myTableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.view endEditing:YES];
}
像拉button一样的拉你的约束.nslayoutattribute也是可以拉线的.
navigationController.hidesBarsOnSwipe = Yes;
[[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