1. 隱藏UITableView多余cell的分割線
tableView.tableFooterView= [[UIView alloc]init];
2. 取消UINavigationController自帶的返回字樣
[[UIBarButtonItem appearance]setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];
3. 滑動時隱藏navigation
self.navigationController.hidesBarsOnSwipe=YES;
4. 頁面跳轉(zhuǎn)是隱藏tabBar
TwoViewController *twoVC = [[TwoViewController alloc] init];
twoVC.hidesBottomBarWhenPushed =YES;
5. ScrollView不能滑到頂
self.automaticallyAdjustsScrollViewInsets=NO;
6. 按鈕點擊發(fā)光效果
button.showsTouchWhenHighlighted =YES;
7.長按手勢只執(zhí)行一次
if(sender.state == UIGestureRecognizerState)
8. 隱藏狀態(tài)欄
- (BOOL)prefersStatusBarHidden{
returnYES;
}
9. 在使用view的縮放的時候,layer.border.width隨著view的放大,會出現(xiàn)鋸齒化的問題。
self.layer.allowsEdgeAntialiasing = YES;
10. 自定義了leftBarbuttonItem左滑返回手勢失效了怎么辦?
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? initWithImage:img? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? style:UIBarButtonItemStylePlain? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? target:self? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? action:@selector(onBack:)];self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
11. 怎么在不新建一個Cell的情況下調(diào)整separaLine的位置?
tableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);
12. CoreData用起來好煩,語法又臭又長,怎么辦?
MagicRecord
13. 本來我的statusbar是lightcontent的,結(jié)果用UIImagePickerController會導(dǎo)致我的statusbar的樣式變成黑色,怎么辦?
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
14. 怎么把我的navigationbar弄成透明的而不是帶模糊的效果?
[self.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
15. 怎么改變uitextfield placeholder的顏色和位置?
繼承uitextfield,重寫這個方法
- (void) drawPlaceholderInRect:(CGRect)rect {
[[UIColor blueColor] setFill];
[self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];
}
16. 遇到了二進(jìn)制顏色,怎么辦呢?
#define UIColorFromRGBValue(rgbValue) ? ? ? ? ? ? ? ?[UIColor colorWithRed:((CGFloat)(rgbValue & 0xFF0000) << 16) / 255 green:((CGFloat)(rgbValue & 0xFF00) << 8) / 255 blue:((CGFloat)(rgbValue) << 0xFF) / 255 alpha:1.0]?