有些知识点很简单, 写下这些作为备忘,好记性不如烂笔头,持续更新中…
-
Xcode
ATS
(App Transport Security的简称)设置
在plist文件中新建类型为Dictionary,key为App Transport Security Settings的键,
在其节点下添加类型为Boolean key为 Allow Arbitrary Loads 值为YES的键值对.
-
设置相机中文环境(打开相机拍照默认是英文)
项目工程-> TARGETS ->Info ->Custom iOS Target Properties,
寻找key值为Localization native development region的一栏修改为China.
-
Xcode 模拟器中输入中文
打开工程项目,command + shift + h : 回到home页;
Settings->General->Language&Region->Other Languages -> Chinese, Simplified(简体中文)-> Done - > Change to Chinese, Simplified -
修改
UISearchBar
的placeholder的字体、字体颜色UITextField *searchField = [self.searchBar valueForKey:@"_searchField"]; [searchField setValue:[UIFont systemFontOfSize:14] forKeyPath:@"_placeholderLabel.font"]; [searchField setValue:[UIColor grayColor] forKeyPath:@"_placeholderLabel.textColor"];
-
Xcode9新建工程运行显示不全屏解决办法
在info.plist文件里配置key为Launch screen interface file base name
value为LaunchImage的string。
屏幕 -
去掉无参block的xcode警告
定义没有参数的blocktypedef void (^Block)();
xcode会有“This block declaration not a prototype”的警告,去掉xcode警告的解决方法:
(1).typedef void (^Block)(void);
(2).typedef void (^Block)(id _Nullable ,...);
-
**setValue 和 setObject 的区别 **
(1). setObject:forkey方法NSMutabledictionary特有的
(2). setValue:forKey方法是KVC(键-值编码)的主要方法
(3). setObject:forkey:中value不能为 nil,key可以是任何类型
(4). setValue:forKey:中value可以是nil,当value为nil的时候,会自动调用setValue:forUndefinedKey:方法
(5). setValue:forKey:中key的参数只能是NSString类型 -
Pods管理三方框架,去掉xcode警告
如ReactiveObjC:在podfile文件中编辑
pod ‘ReactiveObjC’, ‘~> 3.1.0’,:inhibit_warnings => true # RAC -
TableView或者WebView整体上移
self.edgesForExtendedLayout = UIRectEdgeNone;
适用于不同系统版本代码更迭出现状况时使用。 -
Xcode10 #import 不提示头文件
Xcode -> File -> Workspace Settings -> Build System -> Legacy Build System