1 UI控件的一些基础属性
2
3
4 UITextFiled .inputAccessoryView 设置键盘上的toolbar 一般实现键盘的回收
5 UITextFiled .resignFirstResponder 注销收起键盘
6 UITextFiled .leftView 定制UITextFiled左边视图样式
7 UITableViewCell .accessoryView 设置UITableViewCell的删除样式
8 用application设置状态栏时候在Infoplist添加如下:View controller-based status bar appearance 设置为NO
9
10
11 UIViewController setEdgesForExtendedLayout = UIRectEdgeNone
12
13
14
15 NSUserDefaults:
16 强制存储、并非必要, 可以实现的是马上进行存储
17 NSUserDefaults.standardUserDefaults().synchronize()
18
19
20 UIApplication:
21 // 不让手机app睡眠
22 UIApplication.sharedApplication().idleTimerDisabled = true
23 // 网络状态显示
24 UIApplication.sharedApplication().networkActivityIndicatorVisible = true
25 UIApplication.sharedApplication().openURL(NSURL.init(string: UIApplicationOpenSettingsURLString)!)
26 UIButton:
27
28 self.jump?.contentEdgeInsets = UIEdgeInsetsMake(5, 6, 3, 6)
29 self.jump?.contentHorizontalAlignment = .Left
30 NSLocalizedString:
31 let MONTH_SHORT_NAME = [NSLocalizedString("IDS_SHORT_JAN", comment: "”),
32
33
34 MKMapView:
35 func currentZoomScale() ->MKZoomScale {
36 return self.bounds.size.width / CGFloat(self.visibleMapRect.size.width)
37
38 } //返回当前地图的比例尺
39
40 Application:
41 @property(nonatomic, readonly) UIUserInterfaceLayoutDirection userInterfaceLayoutDirection
42 // 返回用户界面的布局方向。
43
44 iOS7之后由于navigationBar.translucent默认是YES,坐标零点默认在(0,0)点 当不透明的时候,零点坐标在(0,64);如果你想设置成透明的,而且还要零点从(0,64)开始,那就添加:self.edgesForExtendedLayout = UIRectEdgeNone;
45
46
47 UIPanGestureRecognizer
48
49 CGPoint translation=[gesture translationInView:self.view];//利用拖动手势的translationInView:方法取得在相对指定视图(这里是控制器根视图)的移动
50
51 CABaseAnimaton 执行完动画之后、确定图片的位子
52 removedOnCompletion:默认为YES,代表动画执行完毕后就从图层上移除,图形会恢复到动画执行前的状态。如果想让图层保持显示动画执行后的状态,那就设置为NO,不过还要设置fillMode为kCAFillModeForwards .