国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

iOS-<項目筆記>UI控件常見屬性總結

2019-11-14 20:40:31
字體:
來源:轉載
供稿:網友

1.UIView  

// 如果userInteractionEnabled=NO,不能跟用戶交互

@PRoperty(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled;

// 控件的標記(父控件通過標記可以找到對應的子控件)

@property(nonatomic) NSInteger tag;

// 控件的位置和尺寸(以父控件的左上角為坐標原點)

@property(nonatomic) CGRect            frame;

// 控件的位置和尺寸(以控件本身的左上角為坐標原點)

@property(nonatomic) CGRect            bounds;

// 控件的中點位置(以父控件的左上角為坐標原點)

@property(nonatomic) CGPoint           center;

// 形變屬性:旋轉、縮放、平移

@property(nonatomic) CGAffineTransform transform;

// 父控件

@property(nonatomic,readonly) UIView       *superview;

// 所有的子控件

@property(nonatomic,readonly,copy) NSArray *subviews;

 

2.UILabel  

// 顯示的文字

@property(nonatomic,copy)   NSString           *text;

// 字體

@property(nonatomic,retain) UIFont             *font;

// 文字顏色

@property(nonatomic,retain) UIColor            *textColor;

// 文字的排列方式(左對齊、居中、右對齊)

@property(nonatomic)        NSTextAlignment    textAlignment;

// 設置行數(行數==0代表自動換行)

@property(nonatomic) NSInteger numberOfLines;

 

3.UIImageView  

// 顯示的圖片

@property(nonatomic,retain) UIImage *image;

// 設置序列幀圖片數組(按順序播放animationImages數組中的圖片)

@property(nonatomic,copy) NSArray *animationImages;

// 序列幀動畫的持續時間

@property(nonatomic) NSTimeInterval animationDuration;

// 序列幀動畫的執行字數(默認是0,代表無限循環)

@property(nonatomic) NSInteger      animationRepeatCount;

 

4.UIScrollView  

// 表示UIScrollView所滾動的位置

@property(nonatomic) CGPoint contentOffset;

// 表示UIScrollView的內容尺寸(能滾動的范圍)

@property(nonatomic)         CGSize                       contentSize;

// 增加UIScrollView額外的邊緣滾動區域

@property(nonatomic)         UIEdgeInsets                 contentInset;

// 代理

@property(nonatomic,assign) id<UIScrollViewDelegate>      delegate;

 

5.UITableView  

 (前幾篇博客已經有很詳細的屬性介紹及使用) 需要查看的可以參考前幾篇博客。

6.UipickerView  

  (前幾篇博客已經有很詳細的屬性介紹及使用) 需要查看的可以參考前幾篇博客。

7.UIControl  

// 是否可用

@property(nonatomic,getter=isEnabled) BOOL enabled;

// 自動擁有很多種狀態

// 可以通過下面的方法來監聽控件內部的一些事件:點擊、值改變

- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;

 

1> UIDatePicker    

// 設置模式(類型)

@property(nonatomic) UIDatePickerMode datePickerMode;   

// 設置區域(zh_CN代表天朝)

@property(nonatomic,retain) NSLocale      *locale;

// 設置當前時間

@property(nonatomic,retain) NSDate        *date;

 

// UIDatePicker內部顯示的日期更改了,就會觸發值改變事件

 

2> UISwitch

// 控制開關狀態

@property(nonatomic,getter=isOn) BOOL on;

- (void)setOn:(BOOL)on animated:(BOOL)animated;

 

// UISwitch內部開關狀態更改了,就會觸發值改變事件

 

3> UISegmentControl  

// 一共有多少塊區域

@property(nonatomic,readonly) NSUInteger numberOfSegments;

// 當前選中區域的位置

@property(nonatomic) NSInteger selectedSegmentIndex;

// UISegmentControl內部選中的區域更改了,就會觸發值改變事件

 

4> UISlider  

// 設置當前的進度值

@property(nonatomic) float value;

// 設置最小的進度值

@property(nonatomic) float minimumValue;

// 設置最大的進度值

@property(nonatomic) float maximumValue;

 // UISlider內部的進度值更改了,就會觸發值改變事件

 

5> UIButton  

// 快速創建一個按鈕

+ (id)buttonWithType:(UIButtonType)buttonType;

// 設置按鈕的內邊距

@property(nonatomic) UIEdgeInsets contentEdgeInsets;

// 按鈕內部的標簽控件

@property(nonatomic,readonly,retain) UILabel     *titleLabel;

// 按鈕內部的圖片控件

@property(nonatomic,readonly,retain) UIImageView *imageView;

 

// 設置內部titleLabel顯示的文字

- (void)setTitle:(NSString *)title forState:(UIControlState)state;

// 設置內部titleLabel的文字顏色

- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;

// 設置內部imageView顯示的圖片

- (void)setImage:(UIImage *)image forState:(UIControlState)state;

// 設置背景圖片

- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;

 

- (NSString *)titleForState:(UIControlState)state;

- (UIColor *)titleColorForState:(UIControlState)state;

- (UIImage *)imageForState:(UIControlState)state;

- (UIImage *)backgroundImageForState:(UIControlState)state;

 

6> UITextField(通過delegate監聽內部的事件)  

 

8.UIAlertView  

// 創建一個UIAlertView對話框

/*

 title : 對話框標題

 message : 對話框中間顯示的文字內容

 cancelButtonTitle : 取消按鈕的文字

 otherButtonTitles : 其他按鈕的文字(設置多個)

 delegate : 用來監聽alertView上面按鈕的點擊

 */

- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id /*<UIAlertViewDelegate>*/)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;

 

// 顯示

- (void)show;

作者: 清澈Saup

出處: http://m.survivalescaperooms.com/qingche/
本文版權歸作者和博客園共有,歡迎轉載,但必須保留此段聲明,且在文章頁面明顯位置給出原文連接。 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 桂东县| 莱阳市| 山东| 井研县| 衡山县| 五河县| 丰镇市| 日照市| 根河市| 上杭县| 清徐县| 高雄市| 成安县| 二手房| 宜兰县| 宜都市| 三明市| 齐齐哈尔市| 来凤县| 邹城市| 泉州市| 和田县| 桃江县| 兴文县| 西充县| 禄丰县| 彭水| 友谊县| 吴江市| 阿拉善左旗| 扎赉特旗| 扬州市| 页游| 宁乡县| 香港| 旬阳县| 胶州市| 阳山县| 读书| 盐山县| 惠水县|