To add an UIView just above the UIKeyBoard write the below mentioned methods to achieve it.
-(UIView *)getTextFieldAccessoryView{
UIButton *cancel = [UIButton buttonWithType:UIButtonTypeCustom];
[cancel setFrame:CGRectMake(0, self.view.bounds.size.height, 320.0, 42.0)];
[cancel setTitle:@"Cancel" forState:UIControlStateNormal];
[cancel setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[cancel addTarget:self action:@selector(cancelTapped) forControlEvents:UIControlEventTouchUpInside];
return cancel;
}
-(void)cancelTapped{
[self.view endEditing:YES];
}
You can customise the view according to your requirements.
Happy Coding
0 Comment(s)