改变UIImagePickerController的导航条以及title的颜色
1 | - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated |
利用KVC改变TextField的占位符的颜色
1 | [self.nickNameTextField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"]; |
TextView的字数限制
1 |
|
判断字符串或者集合类型是否为空
1 | + (BOOL)isEmpty:(id )obj |
给UIResponder添加indexPath属性
列如在cell中有button imageview 可以利用该属性找到cell中改该视图
objective - C
1 | @interface UIResponder (Externtion) |
1 | - (void)setIndexPath:(NSIndexPath *)indexPath |
swift
1 | extension UIResponder{ |
UIRefreshControl
1 | let refresh = UIRefreshControl.init() |
将HTML字符串转化为NSAttributedString富文本字符串
1 | - (NSAttributedString *)attributedStringWithHTMLString:(NSString *)htmlString |
CABasicAnimation(CAKeyframeAnimation)key path 取值
keyPath可以使用的key
1 | - define angle2Radian(angle) ((angle)/180.0*M_PI) |
隐藏导航条和tabBar的直线
1 | UINavigationBar *bar = [UINavigationBar appearance]; |
1 | UITabBar *tabBar = [UITabBar appearance]; |
全屏手势返回
1 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self.interactivePopGestureRecognizer.delegate action:@selector(handleNavigationTransition:)]; |
1 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch |
UITextView的placeholder
1 | - (void)textViewDidBeginEditing:(UITextView *)textView { |
让应用支持摇一摇
- 开启摇一摇权限
1 | [UIApplication sharedApplication].applicationSupportsShakeToEdit = YES; |
- 让view/viewcontroller成为第一响应者
1 |
|
- 实现方发
1 |
|
HeaderView随tableview一起滑动
1 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView |