iOS开发知识点总结(二)
2015-03-27 14:54
453 查看
1.NSString拼接字符串的方法
2.计算文本的高度和宽度
iOS 6-
iOS 7+
3.取出当前项目版本号
4.执行stroyBoard中控制器间的连线
每条连线有个名称
5.MKAnnotationView和MKPinAnnotationView的区别
MKAnnotationView可以使用静态图片作为实例作为view
如果想使用Apple自带的标准大头针,那么需要使用MKPinAnnotationView。
6.取消xcode警告
TARGETS->Build Phases->Compile Sources->警告的文件后加-w
7.UIView移除所有子视图的方法
8.调用iOS系统功能
9.iOS 7 viewcontroller新增属性automaticallyAdjustsScrollViewInsets,即是否根据按所在界面的navigationbar与tabbar的高度,自动调整scrollview的 inset,设置为no,让它不要自动调整就可以
图片的渲染属性
①UIImageRenderingModeAutomatic // 根据图片的使用环境和所处的绘图上下文自动调整渲染模式。
②UIImageRenderingModeAlwaysOriginal // 始终绘制图片原始状态,不使用Tint Color。
③UIImageRenderingModeAlwaysTemplate // 始终根据Tint Color绘制图片,忽略图片的颜色信息。
④ renderingMode属性的默认值是UIImageRenderingModeAutomatic,即UIImage是否使用Tint Color取决于它显示的位置
11.The file “xxxx.app” couldn’t be opened because you don’t have permission to view it
查看工程中警告,发现需要更新旧工程的设置 点击Upate to reconmmented settings 选择Perform Changes,再次运行OK
12.快捷代码片段使用
Title
代码片段的标题
Summary
代码片段的描述文字
Platform
可以使用代码片段的平台,有IOS/OS X/All三个选项
Language
可以在哪些语言中使用该代码片段
Completion Shortcut
代码片段的快捷方式,比如XTableView(当我们在工程中输入XTableView时,会自动用我们的代码片段去替换,或者我们直接将其拖入工程中)
Completion Scopes
可以在哪些文件中使用当前代码片段,比如全部位置,头文件中等,当然可以添加多个支持的位置。
将文本块封装到“<#” 和 “#>”中间,这样code snippet将指出我们可以插入自定义文本的完整范围
13.tableView默认选中第一行
14.设置UITableView表格行上无内容时不显示分割线
15.在不新建一个Cell的情况下调整separaLine的位置
16.点击self.view就让键盘收起
17.滑动的时候隐藏navigationbar
18.CollectionView 怎么实现tableview那种悬停的header?
开源库:CSStickyHeaderFlowLayou
19.navigationbar弄成透明的而不是带模糊的效果
20.改变uitextfield placeholder的颜色和位置
继承UITextField,重写这个方法
NSString* string; // 结果字符串 NSString* string1, string2; //已存在的字符串,需要将string1和string2连接起来 ① string = [NSString initWithFormat:@"%@,%@", string1, string2 ]; ②string = [string1 stringByAppendingString:string2]; ③string = [string stringByAppendingFormat:@"%@,%@",string1, string2];
2.计算文本的高度和宽度
iOS 6-
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:20.0]constrainedToSize:aSize lineBreakMode:UILineBreakModeWordWrap];
iOS 7+
NSDictionary *dict = @{NSFontAttributeName: [UIFont systemFontOfSize:20.0]}; CGSize size = [str boundingRectWithSize:maxSize options:NSStringDrawingUsesL 4000 ineFragmentOrigin attributes:dict context:nil].size;
3.取出当前项目版本号
NSString *key=(NSString *)kCFBundleVersionKey; NSString *version = [NSBundle mainBundle].infoDictionary[key];
4.执行stroyBoard中控制器间的连线
每条连线有个名称
[self performSegueWithIdentifier:@"home" sender:nil];
5.MKAnnotationView和MKPinAnnotationView的区别
MKAnnotationView可以使用静态图片作为实例作为view
如果想使用Apple自带的标准大头针,那么需要使用MKPinAnnotationView。
6.取消xcode警告
TARGETS->Build Phases->Compile Sources->警告的文件后加-w
7.UIView移除所有子视图的方法
[view.subviews. makeObjectsPerformSelector:@selector(removeFromSuperview)];
8.调用iOS系统功能
//调用 自带mail [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]]; //调用 电话phone [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]]; //调用 SMS [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]]; //调用自带 浏览器 safari [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.hzlzh.com"]];
9.iOS 7 viewcontroller新增属性automaticallyAdjustsScrollViewInsets,即是否根据按所在界面的navigationbar与tabbar的高度,自动调整scrollview的 inset,设置为no,让它不要自动调整就可以
self.automaticallyAdjustsScrollViewInsets = NO;
图片的渲染属性
UIImage *image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
①UIImageRenderingModeAutomatic // 根据图片的使用环境和所处的绘图上下文自动调整渲染模式。
②UIImageRenderingModeAlwaysOriginal // 始终绘制图片原始状态,不使用Tint Color。
③UIImageRenderingModeAlwaysTemplate // 始终根据Tint Color绘制图片,忽略图片的颜色信息。
④ renderingMode属性的默认值是UIImageRenderingModeAutomatic,即UIImage是否使用Tint Color取决于它显示的位置
11.The file “xxxx.app” couldn’t be opened because you don’t have permission to view it
查看工程中警告,发现需要更新旧工程的设置 点击Upate to reconmmented settings 选择Perform Changes,再次运行OK
12.快捷代码片段使用
Title
代码片段的标题
Summary
代码片段的描述文字
Platform
可以使用代码片段的平台,有IOS/OS X/All三个选项
Language
可以在哪些语言中使用该代码片段
Completion Shortcut
代码片段的快捷方式,比如XTableView(当我们在工程中输入XTableView时,会自动用我们的代码片段去替换,或者我们直接将其拖入工程中)
Completion Scopes
可以在哪些文件中使用当前代码片段,比如全部位置,头文件中等,当然可以添加多个支持的位置。
将文本块封装到“<#” 和 “#>”中间,这样code snippet将指出我们可以插入自定义文本的完整范围
13.tableView默认选中第一行
//第0区第0行 NSIndexPath *first = [NSIndexPath indexPathForRow:0 inSection:0]; //设置tableView默认选中第一行 [self.tableView selectRowAtIndexPath:first animated:YES scrollPosition:UITableViewScrollPositionTop]; //手动执行选中的方法,用于执行获取子分类 [self tableView:self.tableView didSelectRowAtIndexPath:first];
14.设置UITableView表格行上无内容时不显示分割线
self.tableView.tableFooterView = [[UIView alloc] init];
15.在不新建一个Cell的情况下调整separaLine的位置
_myTableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);
16.点击self.view就让键盘收起
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.view endEditing:YES]; }
17.滑动的时候隐藏navigationbar
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];
18.CollectionView 怎么实现tableview那种悬停的header?
开源库:CSStickyHeaderFlowLayou
19.navigationbar弄成透明的而不是带模糊的效果
[self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationBar.shadowImage = [UIImage new]; self.navigationBar.translucent = YES;
20.改变uitextfield placeholder的颜色和位置
继承UITextField,重写这个方法
- (void) drawPlaceholderInRect:(CGRect)rect { [[UIColor blueColor] setFill]; [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment]; }
相关文章推荐
- 学习IOS开发UI篇--UI知识点总结(二) UILabel/UIImageView
- IOS开发知识点总结(一)
- iOS开发 —— Objective C语言知识点总结
- iOS开发中关于UIImage的知识点总结
- 【iOS开发】iOS知识点总结
- 学习IOS开发UI篇--UI知识点总结(三) UIScrollView/UIPageControl/NSTimer
- iOS开发知识点总结(一)
- iOS开发 —— Objective C语言知识点总结(2)
- iOS开发核心语言Objective C —— 所有知识点总结
- ios开发常用知识点总结
- iOS开发 -- UITableView 完整知识点总结(一)
- iOS开发知识点总结【持续更新】
- iOS开发中关于UIImage的知识点总结
- 【IOS 开发学习总结-OC-38】★ios入门 ——ios项目基础之知识点拾贝
- ios开发之某些知识点总结
- 25条iOS开发中类型的转换和常用的知识点-总结
- iOS开发中关于UIImage的知识点总结
- 25条iOS开发中类型的转换和常用的知识点-总结
- iOS开发知识点总结
- iOS开发核心语言Objective C —— 所有知识点总结