摘要: 属性: //设置右边的指示样式cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;//设置右边的指示控件 cell.accessoryView = [[UISwitch alloc] init];//设置cell的选中样式 阅读全文
posted @ 2020-04-07 00:48 千面客 阅读(286) 评论(0) 推荐(0)
摘要: 多次传入新图片,出现叠加效果 解决: 让self.scrollView.subViews数组中的所有控件都执行removeFromSuperView方法[self.scrollView.subViews makeObjectsPerformSelector:@selector(removeFromS 阅读全文
posted @ 2020-04-07 00:26 千面客 阅读(128) 评论(0) 推荐(0)
摘要: 注意事项:NSTimer是一次性的,要么持续工作,一旦停止工作就无法再次使用 // 返回一个自动开启任务的定时器 self.timer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(nextP 阅读全文
posted @ 2020-04-07 00:23 千面客 阅读(157) 评论(0) 推荐(0)
摘要: 监听控件的行为: - 通过addTarget: 只有继承来自UICotrol的对象,才有这个功能 例如button - 通过delegate: 只有拥有delegate属性的控件,才有这个功能 例如UIScrollView,UITableView - 通过添加手势 一般给控价userinterfac 阅读全文
posted @ 2020-04-07 00:13 千面客 阅读(240) 评论(0) 推荐(0)
摘要: 使用场景:当内容数据一多,在可视的View中就展示不完,这时候就需要用到UIScrollView控件 contentSize设置内容尺寸:UIScrollView会隐藏超出内容的部分,相当于scrollView默认设置了clipToBounds为YES UIScrollView无法滚动的原因: 没有 阅读全文
posted @ 2020-04-07 00:10 千面客 阅读(353) 评论(0) 推荐(0)
摘要: 第一种方式: bg = [bg resizableImageWithCapInsets:UIEdgeInsetsMake(10,10,10,10)];//默认是平铺 bg = [bg resizableImageWithCapInsets:UIEdgeInsetsMake(10,10,10,10) 阅读全文
posted @ 2020-04-06 23:35 千面客 阅读(181) 评论(0) 推荐(0)
摘要: 作用: 可以监听对象属性的改变 使用步骤: 1>.添加监听器 // 利用b对象来监听a对象name属性的改变 [a addObserver:b forKeyPath:@"name" options:NSKeyValueObservingOptionOld | NSKeyValueObservingO 阅读全文
posted @ 2020-04-06 23:27 千面客 阅读(366) 评论(0) 推荐(0)
摘要: 赋值 // 能修改私有成员变量 - (void)setValue:(id)value forKey:(NSString *)key; - (void)setValue:(id)value forKeyPath:(NSString *)keyPath; - (void)setValuesForKeys 阅读全文
posted @ 2020-04-06 23:23 千面客 阅读(381) 评论(0) 推荐(0)
摘要: 第一种 头尾式(现在苹果官方以经废弃): // 开始动画 [UIView beginAnimations:nil context:nil]; // 设置动画时间 [UIView setAnimationDuration:2.0]; /* 需要执行动画的代码 */ // 提交动画 [UIView co 阅读全文
posted @ 2020-04-06 23:03 千面客 阅读(101) 评论(0) 推荐(0)
摘要: 懒加载即第一次用到的时候再去加载,之后加载一次,优化代码 重写属性的get方法 如: -(void)shops { if(_shops == nil){ // 第二次不会进来 // 加载数据 } return _shops;} 注意:在懒加载用,使用set方法,要不然会让懒加载死循环。 阅读全文
posted @ 2020-04-06 22:52 千面客 阅读(118) 评论(0) 推荐(0)