tags:

views:

409

answers:

2

Hi guys, yeah it's me again :)

I've got a little problem.

I've got a custom cell with a TextField. I want the keyboard to hide when i tap "done"

so normally i do this jus with [sender resignFirstResponder].

In this case that doesn't work because the custom cell is a class itself and has its own .h and .m files.

How is it possible to link something like that in general?

A: 

okay, sorry thouht it was clear :)

I've got a UITableViewCell. Within this cell there's a UITextField. If I edit this textfield the keyboard shows up. To hide the keyboard I normally make a function in the obove viewController. It contains only this [sender resignFirstResponder]. In this case that doesn't help.

So the first question is where do i write this action. The second question is: How do i for example set the propertys for a class.(I've got a class like where I define my CLLocationmanager and i want to set the parameter for this in another view controller.

I hope that this is better to understand :)

Sorry for the bad questioning in the first post. Thank you!

Btw I am not able to edit the obove post...

A: 

Set your UITextField's delegate to the UIViewController. You can do this in Interface Builder (if you created your UITableViewCell like that), or through code (in your UIViewController).

tableViewCell.textView.delegate = self

Now, in your UIViewController, add this function:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
  [textField resignFirstResponder];
  return NO;
}

This code hasn't been tested, but it should probably work.

igul222