![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ios知识点总结
shn-1153
这个作者很懒,什么都没留下…
展开
-
UIImageView的两种创建方式的比较
1.UIImageView *imgView = [[UIImageView alloc] init]; imgView.frame = CGRectMake(0, 0, 30, 30); 2.UIImage *imgView = [UIImage imageWithName:@"timeline_image_gif"]; // 这种情况下原创 2016-01-24 12:28:30 · 249 阅读 · 0 评论 -
ios中处理时间是否是今天,昨天,今年
1.创建NSDate的分类 #import "NSDate+MJ.h" /** * 是否为今天 */ - (BOOL)isToday { NSCalendar *calendar = [NSCalendar currentCalendar]; int unit = NSCalendarUnitDay | NSCalendar原创 2016-01-14 21:00:06 · 534 阅读 · 0 评论 -
给UIView添加背景图片的方法
1. self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"timeline_retweet_background"]]; 直接平铺一张图片 2.调用 - (void)drawRect:(CGRect)rect { [[UIImage imageNamed:@"原创 2016-01-13 20:52:05 · 286 阅读 · 0 评论 -
自定义UIPageControl圆点背景图片
// 显示页码的UIPageControl UIPageControl *pageControl = [[UIPageControl alloc] init]; [pageControl setValue:[UIImage imageWithName:@"compose_keyboard_dot_selected"] forKeyPath:@"_currentPageImag原创 2016-01-28 16:39:33 · 797 阅读 · 0 评论 -
OC中的正则匹配
一.OC中原生的正则匹配 //匹配QQ号 - (void)checkQQ { // QQ : 5 ~ 12,全部都是数字 NSString *str = @"8882341"; // 1.产生一个正则表达式对象 NSRegularExpression *regex = [NSRegularExpression reg原创 2016-01-27 20:49:08 · 724 阅读 · 0 评论 -
对 removeObject 的理解
数组调用 removeObject 时底层会调用 - (BOOL)isEqual:(id)object 方法遍历数组中的对象,根据传入的 object 对象的指针,判断当前要比较的对象的指针是否和object的指针一样,如果一样则就是要删出的对象,如果不一样则继续遍历。 如遇到不想根据对象的指针判断两个对象相等,如果只根据对象的某个属性判断两个对象是否相等,则比较对象原创 2016-01-27 16:09:23 · 974 阅读 · 0 评论 -
对NSTimer问题的小总结
创建 NSTimer NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(getUnreadCount) userInfo:nil repeats:YES]; 时,定时器启动时,当主线程在处理刷新UI的操作时,定时器不会调用,需要设置模式才可以。原创 2016-01-10 19:21:56 · 230 阅读 · 0 评论 -
如何使应用保持后台运行
1.在plist文件中设置后台模式 增加 Required background modes -> App plays audio or streams audio/video using AirPlay 2.设置 /** * 程序进入后台的时候调用 */ - (void)applicationDidEnterBackground:(UIApplication *)原创 2016-01-10 18:14:00 · 3799 阅读 · 0 评论 -
使用AFNetworking上传图片
// 1.获得请求管理者 AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager]; // 2.封装请求参数 NSMutableDictionary *params = [NSMutableDictionary dictionary];原创 2016-01-09 10:09:24 · 295 阅读 · 0 评论 -
30. UIScrollView内部子控件添加约束的注意点
30. UIScrollView内部子控件添加约束的注意点: 子控件的尺寸不能通过UIScrollView来计算,可以考虑通过以下方式计算 可以设置固定值(width==100,height==300) 可以相对于UIScrollView以外的其他控件来计算尺寸 UIScrollView的frame应该通过子控件以外的其他控件来计算 UIScrollView的contentSize通过子控件来计算原创 2017-01-03 19:29:17 · 283 阅读 · 0 评论