屬性
1.frame: CGRect ---> 相對于父控件的位置
2.bounds: CGRect ---> 以自身左上角為(0,0)
3.center: CGPoint ---> frame的中心點(diǎn)
4.multipleTouchEnabled: Bool ---> 是否可多點(diǎn)擊,默認(rèn)不可
5.superview: UIView? { get } ---> 父view
6.subviews: [UIView] { get } ---> 子view,可用遍歷全部獲取
7.alpha: CGFloat ---> 透明度,0(全透明)到1(不透明)
8.backgroundColor: UIColor? ---> 顏色
9.hidden: Bool ---> 是否隱藏
contentMode: UIViewContentMode
方法
1.removeFromSuperview() ---> 移除該控件
2.addSubview(view: UIView) ---> 添加子控件
3.bringSubviewToFront(view: UIView) ---> 移動位置
4.public func sendSubviewToBack(view: UIView) ---> 移至底層
動畫效果
有很多,暫時只記錄一個簡單的
- animateWithDuration(duration: NSTimeInterval, animations: () -> Void, completion: ((Bool) -> Void)?)
是type Method, duration是持續(xù)時間,在animations的closure里寫持續(xù)時間顯示的效果,在completion的closure寫持續(xù)時間結(jié)束后顯示的效果
繼承與多態(tài)
父類是UIResponder
有空會持續(xù)更新其子類的常用設(shè)置,
一級子類有16個:
1.UILabel
2.UIImageView
3.UIAlertView
4.UIScrollView ---
5.UIPickerView
6.UISearchBar
7.UIActionSheet
8.UINavigationBar
9.UIWindow
10.UITabBar
11.UIToolbar
12.UITableViewCell
13.UIWebView
14.UIControl ---
15.UIProgressView
16.UIActivitylndicatorView
其中UIScrollView有2個子類 UIControl有7個
//UIScrollView
1.UITextView
2.UITableView
//UIControl
1.UIButton
2.UITextField
3.UISlider
4.UISwitch
5.UIDatePicker
6.UIPageControl
7.UISegmentedControl