iOS iPad開發(fā)~筆記 02

//聯(lián)系人:石虎QQ: 1224614774昵稱:嗡嘛呢叭咪哄

一.UIPickerView

1.UIPickerView的常見屬性

//數(shù)據(jù)源(用來告訴UIPickerView有多少列多少行)

@property(nonatomic,assign)id dataSource;

//代理(用來告訴UIPickerView每1列的每1行顯示什么內(nèi)容,監(jiān)聽UIPickerView的選擇)

@property(nonatomic,assign)id ? delegate;

//是否要顯示選中的指示器

@property(nonatomic)BOOLshowsSelectionIndicator;

//一共有多少列

@property(nonatomic,readonly) NSInteger numberOfComponents;

2.UIPickerView的常見方法

//重新刷新所有列

- (void)reloadAllComponents;

//重新刷新第component列

- (void)reloadComponent:(NSInteger)component;

//主動(dòng)選中第component列的第row行

- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated;

//獲得第component列的當(dāng)前選中的行號

- (NSInteger)selectedRowInComponent:(NSInteger)component;

3.數(shù)據(jù)源方法(UIPickerViewDataSource)

//一共有多少列

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;

//第component列一共有多少行

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;

4.代理方法(UIPickerViewDelegate)

//第component列的寬度是多少

- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component;

//第component列的行高是多少

- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component;

//第component列第row行顯示什么文字

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;

//第component列第row行顯示怎樣的view(內(nèi)容)

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view;

//選中了pickerView的第component列第row行

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;

二.UIDatePicker

1.常見屬性

// datePicker的顯示模式

@property(nonatomic) UIDatePickerMode datePickerMode;

//顯示的區(qū)域語言

@property(nonatomic,retain) NSLocale ? *locale;

2.監(jiān)聽UIDatePicker的選擇

*因?yàn)閁IDatePicker繼承自UIControl,所以通過addTarget:...監(jiān)聽

三.程序啟動(dòng)的完整過程

1.main函數(shù)

2.UIApplicationMain

*創(chuàng)建UIApplication對象

*創(chuàng)建UIApplication的delegate對象

3.delegate對象開始處理(監(jiān)聽)系統(tǒng)事件(沒有storyboard)

*程序啟動(dòng)完畢的時(shí)候,就會調(diào)用代理的application:didFinishLaunchingWithOptions:方法

*在application:didFinishLaunchingWithOptions:中創(chuàng)建UIWindow

*創(chuàng)建和設(shè)置UIWindow的rootViewController

*顯示窗口

3.根據(jù)Info.plist獲得最主要storyboard的文件名,加載最主要的storyboard(有storyboard)

*創(chuàng)建UIWindow

*創(chuàng)建和設(shè)置UIWindow的rootViewController

*顯示窗口

謝謝!!!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容