会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
昊天科技
博客园
首页
新随笔
联系
订阅
管理
2017年6月16日
计算含有表情文字的NSAttributedString的size
摘要: /** * 返回UILabel自适应后的size * * @param aString 字符串 * @param width 指定宽度 * @param height 指定高度 * * @return CGSize */ + (CGSize)sizeLabelToFit:(NSAttributedS
阅读全文
posted @ 2017-06-16 08:42 昊天科技
阅读(549)
评论(0)
推荐(0)
2017年5月2日
获取图片的大小(KB)
摘要: NSData * imageData = UIImageJPEGRepresentation(image,1);length = [imageData length]/1000; 或者是1024,不过1000稍微精准
阅读全文
posted @ 2017-05-02 19:06 昊天科技
阅读(622)
评论(0)
推荐(0)
2017年4月26日
view添加阴影
摘要: tableView.layer.shadowColor = [UIColor blackColor].CGColor; tableView.layer.shadowOpacity = 0.6; tableView.layer.shadowRadius = 5.0; tableView.layer.s
阅读全文
posted @ 2017-04-26 09:21 昊天科技
阅读(178)
评论(0)
推荐(0)
2017年3月28日
按钮图片label位置修改
摘要: //为增加image与titleLabel间的距离 [btn setImageEdgeInsets:UIEdgeInsetsMake(0.0, -10, 0.0, 0.0)]; [btn setTitleEdgeInsets:UIEdgeInsetsMake(0.0, 10, 0.0, 0.0)];
阅读全文
posted @ 2017-03-28 08:57 昊天科技
阅读(416)
评论(0)
推荐(0)
2017年3月21日
权限以及相关设置
摘要: <!-- 相册 --> <key>NSPhotoLibraryUsageDescription</key> <string>App需要您的同意,才能访问相册</string> <!-- 相机 --> <key>NSCameraUsageDescription</key> <string>App需要您
阅读全文
posted @ 2017-03-21 17:32 昊天科技
阅读(145)
评论(0)
推荐(0)
获取当前时间
摘要: - (void)getDateOne { NSDate *date = [NSDate date]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateStyle:NSDateFormatte
阅读全文
posted @ 2017-03-21 09:37 昊天科技
阅读(116)
评论(0)
推荐(0)
2017年3月16日
评论功能,点击textView,弹出键盘,textView上移相同高度
摘要: //_commentView未textview,需要跟随键盘移动的控件,有疑问可留言 //viewDidload中 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillAppear:
阅读全文
posted @ 2017-03-16 14:30 昊天科技
阅读(139)
评论(0)
推荐(0)
2017年2月25日
runloop内部如何实现
摘要: 一般来讲,一个线程一次只能执行一个任务,执行完成后线程就会退出。如果我们需要一个机制,让线程能随时处理事件但并不退出,通常的代码逻辑 是这样的: 1 2 3 4 5 6 7 function loop() { initialize(); do { var message = get_next_mes
阅读全文
posted @ 2017-02-25 21:13 昊天科技
阅读(273)
评论(0)
推荐(0)
以+ scheduledTimerWithTimeInterval...的方式触发的timer,在滑动页面上的列表时,timer会暂定回调,为什么?如何解决?
摘要: RunLoop只能运行在一种mode下,如果要换mode,当前的loop也需要停下重启成新的。利用这个机制,ScrollView滚动过程中NSDefaultRunLoopMode(kCFRunLoopDefaultMode)的mode会切换到UITrackingRunLoopMode来保证Scrol
阅读全文
posted @ 2017-02-25 21:12 昊天科技
阅读(539)
评论(0)
推荐(0)
runloop的mode作用是什么?
摘要: model 主要是用来指定事件在运行循环中的优先级的,分为: NSDefaultRunLoopMode(kCFRunLoopDefaultMode):默认,空闲状态 UITrackingRunLoopMode:ScrollView滑动时 UIInitializationRunLoopMode:启动时
阅读全文
posted @ 2017-02-25 21:11 昊天科技
阅读(1485)
评论(0)
推荐(0)
下一页
公告