uikit学习】的更多相关文章

Important: UIAlertView is deprecated in iOS 8. (Note that UIAlertViewDelegate is also deprecated.) To create and manage alerts in iOS 8 and later, instead use UIAlertController with a preferredStyle ofUIAlertControllerStyleAlert. 在Xcode7中使用UIAlertVie…
storyboard文件的认识 用来描述软件界面 默认情况下,程序一启动就会加载Main.storyboard 加载storyboard时,会首先创建和显示箭头所指的控制器界面 IBAction和IBOutlet IBAction: 本质就是void 能让方法具备连线的功能 IBOutlet 能让属性具备连线的功能 storyboard连线容易出现的问题 连接的方法代码被删掉,但是连线没有去掉 可能会出现方法找不到错误 unrecognized selector sent to instance…
自定义控件 选用xib用自定义view代码与xib相关联 示例代码 + (instancetype)shopView { return [self shopViewWithShop:nil]; } + (instancetype)shopViewWithShop:(XMGShop *)shop { //*注:自定义控件时,尽量把所有关于控件本身逻辑在控件本身处理 XMGShopView *shopView = [[[NSBundle mainBundle] loadNibNamed:NSStri…
如何选择UIButton.UILable.UIImageView 在不添加手势的前提下,只要不涉及到点击和多状态表现就尽量不要选择UIButton…
懒加载 在get中加载,且只加载一次 - (NSArray *)shops { if (_shops == nil) { NSString *file = [[NSBundle mainBundle] pathForResource:@"shops" ofType:@"plist"]; self.shops = [NSArray arrayWithContentsOfFile:file]; //        _shops = [NSArray arrayWithC…
plist是一种iOS本地化轻量级存储方式 创建plist 选择New File-> Resource->plist 加载plist //获得Plist文件的全路径 NSBundle *bundle = [NSBundle mainBundle]; NSString *path = [bundle pathForResource:@"shops" ofType:@"plist"]; //加载plist文件 _shops = [NSArray arrayW…
提示框的背景透明此时要设置background的Alpha值 定时任务 方法1:performSelector // 1.5s后自动调用self的hideHUD方法 [self performSelector:@selector(hideHUD) withObject:nil afterDelay:1.5]; 方法2:GCD dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispat…
代码创建UILabel UILabel *label = [[UILabel alloc] init]; label.text = @"单肩包"; label.frame = CGRectMake(0, 50, 50, 20); label.font = [UIFont systemFontOfSize:11]; label.textAlignment = NSTextAlignmentCenter;…
按钮的功能比较多,既能显示文字,又能显示图片,还能随时调整内部图片和文字的位置 按钮也是一种容器,在这一点上跟UIView类似 按钮的三种状态 normal(普通状态) 默认情况(Default) 对应的枚举常量:UIControlStateNormal highlighted(高亮状态) 按钮被按下去的时候(手指还未松开) 对应的枚举常量:UIControlStateHighlighted disabled(失效状态,不可用状态) 如果enabled属性为NO,就是处于disable状态,代表…
UIView是Cocoa大多控件的父类,本身不带事件. UIView的常见用法 @property(nonatomic,readonly) UIView *superview; 获得自己的父控件对象 @property(nonatomic,readonly,copy) NSArray *subviews; 获得自己的所有子控件对象 @property(nonatomic) CGAffineTransform transform; 控件的形变属性(可以设置旋转角度.比例缩放.平移等属性)(特别对于…