1、设置button的正面投影效果:
self.layer.shadowOffset = CGSizeMake(1, 1);
self.layer.shadowOpacity = 0.6;
self.layer.shadowColor = [UIColor blackColor].CGColor;
2、设置label某个文字的颜色大小:
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:label.text];
//设置字号
[str addAttribute:NSFontAttributeName value:font range:range];
//设置文字颜色
[str addAttribute:NSForegroundColorAttributeName value:vaColor range:range];
label.attributedText = str;
3、自定义UINavigationController的leftBarButtonItem按钮右滑返回
a、
/////在push前充值器设置代理
- (void)viewDidAppear:(BOOL)animated {
self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;//代理
self.navigationController.interactivePopGestureRecognizer.enabled = NO;//不能右滑
}
//////推出后设置Pop能滑动
- (void)viewDidLoad{
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
b、
UIImage *backimg = [UIImage imageNamed:@"返回icon"];
backimg = [backimg imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationBar.backIndicatorImage = backimg;
self.navigationBar.backIndicatorTransitionMaskImage = backimg;
UIBarButtonItem *buttonItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UINavigationBar class]]];
UIOffset offset;
offset.horizontal = -500;
[buttonItem setBackButtonTitlePositionAdjustment:offset forBarMetrics:UIBarMetricsDefault];
- if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"baidumap://"]])// -- 使用 canOpenURL 判断需要在info.plist 的 LSApplicationQueriesSchemes 添加 baidumap 。
a.设置tableview的tablefooterview为一个空的view;
b.设置separator的样式style为None并且自定义cell的边线;
c.tableview的style设置为Grouped;(跟a/b的区别是最后一条分割线是封闭的)
6、iOS添加边缘手势实现侧滑
UIScreenEdgePanGestureRecognizer *interactiveTransitionRecognizer;
interactiveTransitionRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(interactiveTransitionRecognizerAction:)];
interactiveTransitionRecognizer.edges = UIRectEdgeRight;
[self.view addGestureRecognizer:interactiveTransitionRecognizer];
7、+(BOOL) resolveInstanceMethod:(SEL) sel
这是NSObject根类提供的类方法,调用时机为当被调用的方法实现部分没有找到,而消息转发机制启动之前的这个中间时刻。