Monday 18 May 2015

How to add UIView above UIKeyBoard in Objective C

To add an UIView just above the UIKeyBoard write the below mentioned methods to achieve it.
  1. -(UIView *)getTextFieldAccessoryView{
  2. UIButton *cancel = [UIButton buttonWithType:UIButtonTypeCustom];
  3. [cancel setFrame:CGRectMake(0, self.view.bounds.size.height, 320.0, 42.0)];
  4. [cancel setTitle:@"Cancel" forState:UIControlStateNormal];
  5. [cancel setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  6. [cancel addTarget:self action:@selector(cancelTapped) forControlEvents:UIControlEventTouchUpInside];
  7. return cancel;
  8. }
  9. -(void)cancelTapped{
  10. [self.view endEditing:YES];
  11. }
You can customize the view according to your requirements.

For such more Blogs you can visit to http://findnerd.com/NerdDigest

No comments:

Post a Comment