如何让UIViewController自动弹出PickerView
2014-03-27 10:31 三戒1993 阅读(128) 评论(0) 编辑 收藏 举报因为响应者的一下属性inputView和inputAccessoryView都是只读的,所以如果想要指定弹出的view就要override 下面两个属性的get和set方法
UIResponder (UIResponderInputViewAdditions)
@property (readonly, retain) UIView *inputView NS_AVAILABLE_IOS(3_2);
@property (readonly, retain) UIView *inputAccessoryView NS_AVAILABLE_IOS(3_2);
//write this code in UIViewController //UIViewController default is NO. //override - (BOOL)canBecomeFirstResponder { return YES; } //override - (UIView*) inputView { return [[UIDatePicker alloc] init]; }
版权声明:本文为博主原创文章,未经博主允许不得转载。