一行代码,可上青天

来源:互联网 发布:网络推广博客 编辑:程序博客网 时间:2024/05/16 01:14

1.表视图末尾不显示空行。

self.tableView.tableFooterView = [[UIView alloc]init];


2.设置UITextField的placeHolder的字体。

[textField setValue:[UIFont systemFontOfSize:12

         forKeyPath:@"_placeholderLabel.font"];


3.设置CELL的风格为箭头样式。

cell.accessoryTypeUITableViewCellAccessoryDisclosureIndicator;


4.获取刚好容纳特定字体字符串的矩形大小

CGRect rect = [@"我爱你,中boundingRectWithSize:

               CGSizeMake(300,MAXFLOAT)

              options:NSStringDrawingUsesLineFragmentOrigin 

           attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]

              context:nil];


5.取消系统对UIScrollView初始位置的调整

self.automaticallyAdjustsScrollViewInsetsNO;


6.取消视图的自动计算布局

[self.view setTranslatesAutoresizingMaskIntoConstraints:NO];


7.取消tableView滑动时出现的分割线

self.tableView.separatorStyleUITableViewCellSeparatorStyleNone;


8.状态栏网络风火轮设置

[[UIApplication sharedApplication

 setNetworkActivityIndicatorVisible:YES];


9.键盘透明

textField.keyboardAppearanceUIKeyboardAppearanceAlert;


10.获取沙盒中"documents"的路径

NSString *path =[NSSearchPathForDirectoriesInDomains(

             NSDocumentDirectory,NSUserDomainMask,YESfirstObject];
























2 0
原创粉丝点击