属性
1.frame: CGRect ---> 相对于父控件的位置
2.bounds: CGRect ---> 以自身左上角为(0,0)
3.center: CGPoint ---> frame的中心点
4.multipleTouchEnabled: Bool ---> 是否可多点击,默认不可
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是持续时间,在animations的closure里写持续时间显示的效果,在completion的closure写持续时间结束后显示的效果
继承与多态
父类是UIResponder
有空会持续更新其子类的常用设置,
一级子类有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