iOS 小技巧总结

 

代码版本:

1  NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"点击注册代表您已经同意我们的《用户协议》"];
2     NSRange strRange = {14,6};
3     [str addAttribute:NSForegroundColorAttributeName value:[UIColor colorInSkinWithKey:@"useColor1"] range:strRange];  //设置颜色
4     [str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];
5 
6 //因为是   NSMutableAttributedString  所以要使用
7 
8 [_radioButton setAttributedTitle:str forState:UIControlStateNormal];

 

经常看新手一个一个输入框的收键盘,其实一句话就好了:

@interface UIView (UITextField)
- (BOOL)endEditing:(BOOL)force;    // use to make the view or any subview that is the first responder resign (optionally force)
@end
[view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; //删除所有子视图

 

posted @ 2015-08-28 23:25  iOS-轻狂书生  阅读(161)  评论(1编辑  收藏  举报