随笔分类 -  iOS开发

摘要:在子线程中是不能进行UI 更新的,而可以更新的结果只是一个幻像:因为子线程代码执行完毕了,又自动进入到了主线程,执行了子线程中的UI更新的函数栈,这中间的时间非常的短,就 让大家误以为分线程可以更新UI。如果子线程一直在运行,则子线程中的UI更新的函数栈 主线程无法获知,即无法更新 参考:http: 阅读全文
posted @ 2016-04-06 21:37 王权 阅读(686) 评论(0) 推荐(0)
摘要:1.创建数据库 NSString * docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject]; NSLog(@"%@",docPath); NSStri 阅读全文
posted @ 2016-03-31 21:55 王权 阅读(283) 评论(0) 推荐(0)
摘要:NSDate *date = [NSDate date]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"YYYYMMddhhmmss"]; NSString *form 阅读全文
posted @ 2016-03-31 21:52 王权 阅读(130) 评论(0) 推荐(0)
摘要:UIAlertController * alert =[UIAlertController alertControllerWithTitle:@"新建相册" message:@"请输入新建相册的名字" preferredStyle:UIAlertControllerStyleAlert]; UIAl 阅读全文
posted @ 2016-03-31 21:50 王权 阅读(123) 评论(0) 推荐(0)
摘要:NSUserDefault —— 保存少量数据 文件 —— 图片 视频 一个资源就是一个文件 数据库 —— SQLite3 C语言存储 CareData —— 可以以对象存储 应用程序的沙盒 1.获取应用程序允许用户操作的Document路径 NSString * docPath = [NSSear 阅读全文
posted @ 2016-03-31 21:49 王权 阅读(183) 评论(0) 推荐(0)
摘要:NSFileCreationDate和NSFileModificationDate两个属性分别代表文件创建时间和修改时间 NSArray *sortedPaths = [array sortedArrayUsingComparator:^(NSString * firstPath, NSString 阅读全文
posted @ 2016-03-31 21:45 王权 阅读(718) 评论(0) 推荐(0)
摘要://查看是否授权了。 if ([PHPhotoLibrary authorizationStatus] != PHAuthorizationStatusAuthorized){ NSLog(@"没有授权"); } //PHAsset 可以表示一个图片的信息 相册信息 //PHFetchResult 阅读全文
posted @ 2016-03-31 21:30 王权 阅读(233) 评论(0) 推荐(0)
摘要:注册消息 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(方法) name:@"消息名字" object:nil]; 方法实现 -(void)方法:(NSNotification *)notficati 阅读全文
posted @ 2016-03-01 09:10 王权 阅读(157) 评论(0) 推荐(0)
摘要:创建显示的页面 SearchViewController * searchVC = [[SearchViewController alloc]init]; 告诉搜索控制器将结果显示在创建的页面上 self.searchController = [[UISearchController alloc]i 阅读全文
posted @ 2016-03-01 09:02 王权 阅读(133) 评论(0) 推荐(0)
摘要:- (void)viewDidLoad { [super viewDidLoad]; self.myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 568) style:UITableViewStyleGroup 阅读全文
posted @ 2016-03-01 08:58 王权 阅读(129) 评论(0) 推荐(0)
摘要:1.contentSize幕布实际大小决定滚动的方向,如果小于图片本身不滚动,默认也是不滚动 view.contentSize = CGSizeMake(1280, 200); 而frame只是用来显示UIScrollView的显示区域的大小用户看的到的。 2.页面效果,图片不可以停留在两张图中间 阅读全文
posted @ 2016-01-30 21:50 王权 阅读(129) 评论(0) 推荐(0)
摘要:效果图首先你得画出这只眼睛,这是眼睛包括5个部分组成:1 @property (strong, nonatomic) CAShapeLayer *eyeFirstLightLayer;2 @property (strong, nonatomic) CAShapeLayer *eyeSecondLig... 阅读全文
posted @ 2016-01-26 20:55 王权 阅读(265) 评论(0) 推荐(0)
摘要:#import "ViewController.h"@interface ViewController ()@property (nonatomic,strong) CALayer *hourLayer;@property (nonatomic,strong) CALayer *minLayer;@... 阅读全文
posted @ 2016-01-25 19:57 王权 阅读(126) 评论(0) 推荐(0)
摘要://显隐 CABasicAnimation *capacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; capacityAnimation.fromValue = @1; capacityAnimation.t... 阅读全文
posted @ 2016-01-25 18:47 王权 阅读(135) 评论(0) 推荐(0)
摘要:1.KVCKVC是Key-Value-Coding的简称,它是一种可以直接通过字符串的名 字(key)来访问类属性(实例变量)的机制。而不是通过调用Setter、Getter方法访问。当使用KVO、Core Data、CocoaBindings、AppleScript(Mac支持)时,KVC是关键技... 阅读全文
posted @ 2016-01-24 22:38 王权 阅读(141) 评论(0) 推荐(0)
摘要:1.单例模式的要点: 显然单例模式的要点有三个;一是某个类只能有一个实例;二是它必须自行创建这个实例;三是它必须自行向整个系统提供这个实例。2.单例模式的优点: 1.实例控制:Singleton 会阻止其他对象实例化其自己的 Singleton 对象的副本,从而确保所有对象都访问唯一实例。 2... 阅读全文
posted @ 2016-01-24 22:35 王权 阅读(153) 评论(0) 推荐(0)
摘要:1.contentModeview.contentMode = UIViewContentModeScaleAspectFill;2.是否实现触摸 3.简单实现动画 图片的名字为campFire01-campFire17 NSMutableArray * imagearray = [NSMutabl... 阅读全文
posted @ 2016-01-19 20:28 王权 阅读(197) 评论(0) 推荐(0)
摘要:1.默认文本 _loginTextField.placeholder = @"QQ号/手机";2.设置边框 _loginTextField.borderStyle = UITextBorderStyleRoundedRect; typedef enum { UITextBorderSty... 阅读全文
posted @ 2016-01-19 20:25 王权 阅读(141) 评论(0) 推荐(0)
摘要:RTLabel和RegexKitLite都要导入第三方库 使用Regexkitlite库进行正则表达式的解析 1.库是使用MRR,如果在ARC工程里面使用这个类,必须在project->build phases->compile resources里面将regexKitLite.m的编译... 阅读全文
posted @ 2016-01-18 20:02 王权 阅读(228) 评论(0) 推荐(0)
摘要:UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 300, 100)];1.设置文字颜色 label.textColor = [UIColor orangeColor]; label2... 阅读全文
posted @ 2016-01-18 20:00 王权 阅读(194) 评论(0) 推荐(0)