计算文字高度
// 文字所处的区域
CGSize textRect = CGSizeMake(ZHScreenW - 2 * ZHMagin, MAXFLOAT);
CGFloat textLableMaxY = ZHHeadImageY + ZHMagin + [self.text boundingRectWithSize:textRect options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:14]} context:nil].size.height;
升级了Xcode7,遇到问题
网络请求失败:App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
原因:iOS9默认使用HTTPS请求
解决方法(二选一):
-
让服务器支持https
-
暂时退回http请求:在工程的Info.plist文件里添加NSAppTransportSecurity字典类型的,添加一个元素:key为NSAllowsArbitraryLoads,值为YES

移动文件
NSFileManager *manager = [NSFileManager defaultManager];
[manager moveItemAtURL:location toURL:[NSURL fileURLWithPath:toPath] error:nil];
ARC和非ARC的配置
// 不使用
arc-fno-objc-arc
// 使用
arc-fobjc-arc
设置圆形UIImageView
cell.headerView.layer.cornerRadius = cell.headerView.frame.size.width/2;
cell.headerView.layer.masksToBounds = YES;
设置UITextfield编辑时出现的清空内容x按钮
_loginTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
// 从不出现
UITextFieldViewModeNever
// 编辑的时候出现
UITextFieldViewModeWhileEditing
// 除了编辑外都出现
UITextFieldViewModeUnlessEditing
// 不出现
UITextFieldViewModeAlways
设置导航栏背景色
self.navigationController.navigationBar.barTintColor = [UIColor blueColor];
网友评论