preamble
This is the first ui advanced
key learning UIPickerVIew and UIDatePicker and UIBarButtonItme and UIToolbar
and application objects
UIPickerView
Select data for
implementing data source Method DateSource
- (NSInteger) numberOfComponentsInPickerView: (UIPickerView) pickerView;
Returns number group
- (NSInteger) pickerVIew: (UIPickerView ) pickerView numberOfRowsInComponent;
returns how many rows each
Implementing a proxy method Delegate
- (NSString *) titleForRow; what they return string is displayed for each group
- (UIview) viewforrow; return uive way to customize each group, although there reusingview but in vain
- (void) didSelectRow; returns selected underwent the execution result
- rows (CGFloat) rowHeightForComponent high return each
self pickerview (didSelectRow call is overridden method)
self.picerview SelectRow: Line inComponent: Group animated: Animation (selected by default data)
selectedRowInComponent: the I // get the group is currently selected row
reloadcomponent refresh a group
supplement: arc4random_uniform (xx ); generating a random number
UIToolbar
Is a wrapper off UIView, which is to be placed uibuttonItem
set lazy loading: width may not be set, but must set the height
uitoolbar.items = @ [ub1, ub2] ; // add uibarbuttonitem to the inside.
Creating UiBarButtonItem use initWithTitle have initialization parameters
initWithTitle: Title
sytle: UIBarButtonItemStylePlain using the default style
target: event handler class, action: SEL
Use UiBarButtonItem create the type of spring systems
use initWithBarButtonSystemItem parameters
UIBarButtonSystemItemFlexibleSpace to enumerate
UIDatePicker
Selecting a date after the keyboard click the box to select the date of replacement
is generally not a separate interface into the uidatepickerview
DatePicker different modes. Display the year / sec display / Time the like
datePicker.date currently available assembly time
Lazy loading basic initialization
.datePickerMode = UIDatePickerModeDate // time displayed in the form of an enumeration
.datePicker.locale = [[NSLoCale alloc] initWithLocaleIdentifier : @ "zh-Hans"]
The text box input source UIDatePicker
UIDatePicker the text box inputVIew
UIToolbar the text box inputAccessoryView
Exercise
NSDate *date = self.datePicker.date
NSDAteFormatter *formatter = [NSDateFormatter alloc]init]
formatter.dateFormat = @“yyyy年MM月dd日”
NSString *str = [formatter stringFromDate :date]
info.plist
NSBundle mainBundel] .infoDictionary can get.