Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

UITextField inside UITableView

jbejbe Posts: 2New Users
edited September 2010 in iPhone SDK Development
Hi,
I insert in my tableview the textfields i have created and it works. But when i click the "Done" button, nothing happens. It can't reach the textFieldShouldReturn function so it can't reach [textField resignFirstResponder].
An idea?
Post edited by jbe on

Replies

  • jbejbe Posts: 2New Users
    edited September 2009
    jbe wrote: »
    Hi,
    I insert in my tableview the textfields i have created and it works. But when i click the "Done" button, nothing happens. It can't reach the textFieldShouldReturn function so it can't reach [textField resignFirstResponder].
    An idea?

    Ok, my problem was the delegate! I solve it on myself
  • funnylookinhatfunnylookinhat Posts: 9New Users
    edited September 2009
    JBE - How are you able to put UITextFields into your UITableView?? I'm trying to do it and can't figure it out...
  • zeeshanzeeshan Posts: 8New Users
    edited April 2010
    JBE - How are you able to put UITextFields into your UITableView?? I'm trying to do it and can't figure it out... please reply

    zeeshan khan
  • zeeshanzeeshan Posts: 8New Users
    edited April 2010
    funnylookinhat - Did you get success in putting UITextField into your UITableView. Please let me know if you done it.
    Thanks in advance
  • funnylookinhatfunnylookinhat Posts: 9New Users
    edited April 2010
    zeeshan wrote: »
    funnylookinhat - Did you get success in putting UITextField into your UITableView. Please let me know if you done it.
    Thanks in advance

    Yes, there are a couple of ways you can do this.

    The easiest way is to create UITableViewCells with Interface Builder, and put text fields in them. Link both the cell and the text field to whatever controller manages the datasource/delegate for the UITableView.

    So for example, let's say you create the following:
    IBOutlet UITableViewCell *cell1;
    UITextField *text1;
    IBOutlet UITableViewCell *cell2;
    UITextField *text2;
    IBOutlet UITableViewCell *cell3;
    UITextField *text3;
    

    In your cellForRowAtIndexPath function you would do the following:
    if([indexPath row] == 0) {
        return cell1;
    } else if([indexPath row] == 1) {
        return cell2;
    } else {
        return cell3;
    }
    

    Then you can just reference the text fields as normal - connect them with interface builder, etc.

    Does that help?
  • kguptakgupta Posts: 26Registered Users
    edited September 2010
    Can we display a UITextField in side a UILabel and this UILabel is a cell in UITableView.


    Yes, there are a couple of ways you can do this.

    The easiest way is to create UITableViewCells with Interface Builder, and put text fields in them. Link both the cell and the text field to whatever controller manages the datasource/delegate for the UITableView.

    So for example, let's say you create the following:
    IBOutlet UITableViewCell *cell1;
    UITextField *text1;
    IBOutlet UITableViewCell *cell2;
    UITextField *text2;
    IBOutlet UITableViewCell *cell3;
    UITextField *text3;
    

    In your cellForRowAtIndexPath function you would do the following:
    if([indexPath row] == 0) {
        return cell1;
    } else if([indexPath row] == 1) {
        return cell2;
    } else {
        return cell3;
    }
    

    Then you can just reference the text fields as normal - connect them with interface builder, etc.

    Does that help?
  • funnylookinhatfunnylookinhat Posts: 9New Users
    edited September 2010
    kgupta wrote: »
    Can we display a UITextField in side a UILabel and this UILabel is a cell in UITableView.

    No - You can't. The reason is that a UILabel does not possess a view property - so you can't make a UITextVield (View) the view within a UILabel.

    What exactly are you trying to do? Having a UITextField inside a UILabel inside a UITableView seems quite roundabout.
  • kguptakgupta Posts: 26Registered Users
    edited September 2010
    I want to display 7 UITextFiels in UITableView cell in one line. How can it be done.

    Thanks.

    No - You can't. The reason is that a UILabel does not possess a view property - so you can't make a UITextVield (View) the view within a UILabel.

    What exactly are you trying to do? Having a UITextField inside a UILabel inside a UITableView seems quite roundabout.
Sign In or Register to comment.