UITextField InputAccessaryView + InputView
#import <UIKit/UIKit.h>
#import "BaseViewController.h"
@interface LoginViewController : BaseViewController<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *nameTxt;
@property (weak, nonatomic) IBOutlet UITextField *psdTxt;
@end
@implementation LoginViewController
- (void)methodOfInputAccessaryView {
UIToolbar * topView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 35)];
[topView setBarStyle:UIBarStyleDefault];UIBarButtonItem* myBn = [[UIBarButtonItem alloc]
initWithTitle:@"<"
style:UIBarButtonItemStyleDone
target:self action:@selector(nameTxtFinish)];
UIBarButtonItem* myBn1 = [[UIBarButtonItem alloc]
initWithTitle:@" >"
style:UIBarButtonItemStyleDone
target:self action:@selector(psdTxtFinish)];
UIBarButtonItem* spaceBn = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:self action:nil];
UIBarButtonItem* doneBn = [[UIBarButtonItem alloc]
initWithTitle:@"Done"
style:UIBarButtonItemStyleDone
target:self action:@selector(editFinish)];
NSArray * buttonsArray = [NSArray arrayWithObjects
:myBn,myBn1,spaceBn,doneBn,nil];
[topView setItems:buttonsArray];
[_nameTxt setInputAccessoryView:topView];
[_psdTxt setInputAccessoryView:topView];
}
- (void)methodOfInputView {
// create a view like PickerView/date Picker
UIPickerView *pickerView = .........
[_nameText setInputView:pickerView];
}