摘要:
/** * 返回UILabel自适应后的size * * @param aString 字符串 * @param width 指定宽度 * @param height 指定高度 * * @return CGSize */ + (CGSize)sizeLabelToFit:(NSAttributedS 阅读全文
摘要:
NSData * imageData = UIImageJPEGRepresentation(image,1);length = [imageData length]/1000; 或者是1024,不过1000稍微精准 阅读全文
摘要:
tableView.layer.shadowColor = [UIColor blackColor].CGColor; tableView.layer.shadowOpacity = 0.6; tableView.layer.shadowRadius = 5.0; tableView.layer.s 阅读全文
摘要:
//为增加image与titleLabel间的距离 [btn setImageEdgeInsets:UIEdgeInsetsMake(0.0, -10, 0.0, 0.0)]; [btn setTitleEdgeInsets:UIEdgeInsetsMake(0.0, 10, 0.0, 0.0)]; 阅读全文
摘要:
<!-- 相册 --> <key>NSPhotoLibraryUsageDescription</key> <string>App需要您的同意,才能访问相册</string> <!-- 相机 --> <key>NSCameraUsageDescription</key> <string>App需要您 阅读全文
摘要:
- (void)getDateOne { NSDate *date = [NSDate date]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateStyle:NSDateFormatte 阅读全文
摘要:
//_commentView未textview,需要跟随键盘移动的控件,有疑问可留言 //viewDidload中 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillAppear: 阅读全文
摘要:
一般来讲,一个线程一次只能执行一个任务,执行完成后线程就会退出。如果我们需要一个机制,让线程能随时处理事件但并不退出,通常的代码逻辑 是这样的: 1 2 3 4 5 6 7 function loop() { initialize(); do { var message = get_next_mes 阅读全文
摘要:
RunLoop只能运行在一种mode下,如果要换mode,当前的loop也需要停下重启成新的。利用这个机制,ScrollView滚动过程中NSDefaultRunLoopMode(kCFRunLoopDefaultMode)的mode会切换到UITrackingRunLoopMode来保证Scrol 阅读全文
摘要:
model 主要是用来指定事件在运行循环中的优先级的,分为: NSDefaultRunLoopMode(kCFRunLoopDefaultMode):默认,空闲状态 UITrackingRunLoopMode:ScrollView滑动时 UIInitializationRunLoopMode:启动时 阅读全文