Reputation:
I am creating an application. I have to implement a bookmark feature, and adding one should be similar to this:
mmm http://img534.imageshack.us/img534/9859/schermafbeelding2010040a.png
I want editable UITableViewCell
s for text input. I was wondering if there is an easier way then embedding a UITextField
into a UITableViewCell
. And if not, can someone explain how I can use the UITextField
inside it? Thanks
Upvotes: 3
Views: 9970
Reputation: 9457
You can just add a textfield to the contentView of your cell, and an (X) button to the accessoryView of your cell. You could do that in a UITableView subclass which would let you add keep track of your added elements with instance variables or properties.
I found this helpful: Cocoa With Love: Easy custom UITableView drawing
Like this:
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"myEditableCellId"];
label = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
[cell.contentView addSubview:label];
Upvotes: 2
Reputation: 83
You can use https://github.com/escoz/QuickDialog for simple cases like that. But you probably need to write your own custom cell if it's more complex.
Upvotes: 0
Reputation: 4843
There isn't an easier way, you will have to subclass UITableViewCell and add in the UITextField. Here is a tutorial for using a UITextView should be about the same as a UITextField.
Upvotes: 5