码迷,mamicode.com
首页 > 移动开发 > 详细

iOS开发笔记

时间:2016-04-13 02:03:08      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

#Mac系统设置 ``` # 显示被隐藏的文件 $ defaults write com.apple.finder AppleShowAllFiles TRUE $ killall Finder # 禁用dashboard $ defaults write com.apple.dashboard mcx-disabled -boolean YES $ killall Dock ``` #SVN ``` # 查看帮助 $ svn help 命令 # 检出 $ svn co 协议://路径 本地路径 --username=用户名 --password=密码 # 导出不带.svn文件夹的目录树 $ svn export -r 版本号 协议://路径 本地路径 --username=用户名 # 添加文件 $ svn add 文件 # 提交 $ svn ci -m "注释" # 删除 $ svn del # 更新 $ svn up # 查看状态 $ svn st # 恢复本地修改 $ svn revert # 解决冲突 $ svn resolved # 创建分支 $ svn copy branchA branchB -m "从branchA拷贝出一个新分支branchB" # 合并分支(把对branchA的修改合并到分支branchB) $ svn merge branchA branchB ``` #CocoaPods #icon ``` 57x57 114x114 120x120 180x180 ``` #创建纯代码项目 ``` - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window.rootViewController = [[ViewController alloc] init]; [self.window makeKeyAndVisible]; return YES; } ``` #隐藏状态栏 ``` - (BOOL)prefersStatusBarHidden { return YES; } ``` #结束键盘输入 ``` [self.view endEditing:YES]; ``` #字典转模型 ``` - (instancetype)initWithDict:(NSDictionary *)dict{ if (self = [super init]) { [self setValuesForKeysWithDictionary:dict]; } return self; } + (instancetype)modelWithDict:(NSDictionary *)dict{ return [[self alloc] initWithDict:dict]; } ``` ``` - (instancetype)initWithDict:(NSDictionary *)dict{ if (self = [super init]) { [self setValuesForKeysWithDictionary:dict]; NSMutableArray *tempArray = [NSMutableArray array]; for (NSDictionary *dict in self.models) { Model *model = [Model modelWithDict:dict]; [tempArray addObject:model]; } self.models = tempArray; } return self; } + (instancetype)groupWithDict:(NSDictionary *)dict{ return [[self alloc] initWithDict:dict]; } ``` #懒加载 ``` - (NSArray *)groups{ if (_groups == nil) { NSArray *dictArray = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"test" ofType:@"plist"]]; NSMutableArray *tempArray = [NSMutableArray array]; for (NSDictionary *dict in dictArray) { GroupModel *group = [GroupModel groupWithDict:dict]; [tempArray addObject:group]; } _groups = tempArray; } return _groups; } ``` #应用间跳转 在info.plist中: * 添加 URL types -> URL Schemes 并设置 URL identifier * 添加 App Transport Security Settings -> Allow Arbitrary Loads 设置成YES * 添加 LSApplicationQueriesSchemes 数组,里面存放各个自定义协议 * 编写代码: ``` UIApplication *app = [UIApplication sharedApplication]; NSURL *url = [NSURL URLWithString:@"testA://com.iospp.A"]; if ([app canOpenURL:url]) { [app openURL:url]; } ```

iOS开发笔记

标签:

原文地址:http://www.cnblogs.com/iospp/p/5385190.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!