您好,登錄后才能下訂單哦!
UISwitch(開關(guān),默認為關(guān))
IOS開發(fā)中必不可少的基本控件,主要用于只有兩種的選擇,比如飛行模式等等,本文主要是列出常用的屬性及方法(注XCode版本為7.2)
//默認狀態(tài)
//屬性
@property(nullable, nonatomic, strong) UIColor *onTintColor ;//開著的時候控件的顏色
代碼:one.onTintColor=[UIColor brownColor];
如圖:
@property(null_resettable, nonatomic, strong) UIColor *tintColor ;//感覺像是邊框的顏色,并且?guī)в袆赢嫞?/span>
代碼:one.tintColor=[UIColor redColor];
如圖:第二張像個動畫
@property(nullable, nonatomic, strong) UIColor *thumbTintColor ;// 按鈕的顏色
代碼:
one.thumbTintColor=[UIColor blueColor];
如圖:
@property(nonatomic,getter=isOn) BOOL on;//是否處于開啟狀態(tài),默認為NO
//方法
- (instancetype)initWithFrame:(CGRect)frame ; // 設(shè)置控件的大小和起始位置
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder ;//從XIB加載
- (void)setOn:(BOOL)on animated:(BOOL)animated; // 開的時候是否有動畫
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。