推薦一個Button 彈起PickerView的源碼,也可以作為工具類使用。
利用inputView 做鍵盤彈起動畫。該如何做呢?
1.繼承UIView
2.重寫屬性&方法
@property (readwrite) UIView *inputView; @property (readwrite) UIView *inputAccessoryView; - (BOOL)isUserInteractionEnabled { return YES; } - (BOOL)canBecomeFirstResponder { return YES; }
3.添加TapGesture
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchAction)]; [tap setNumberOfTouchesRequired:1]; [tap setNumberOfTapsRequired:1]; [self addGestureRecognizer:tap];
4.實現方法touchAction
以上所述是小編給大家介紹的iOS中利用inputView 彈出 picker,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對本站網站的支持!