Hi,
I need to customize each cell in a UITableView (like each cell will have UITextfield and UIButton). Could you let me know if there is any good article on that?
Thanks.
Hi,
I need to customize each cell in a UITableView (like each cell will have UITextfield and UIButton). Could you let me know if there is any good article on that?
Thanks.
UITableView
cells respond to selections - it get's handled in tableView:didSelectRowAtIndexPath
, maybe this satisfies your UIButton requirement. In case where you need UIButton it should not be difficult - it is just another UIView component.
Easy custom UITableView drawing is a detailed article on customizing UITableView
. It goes beyond what you want but you may find useful details. Have a look at section Layout within the contentView for how to add views to cell - the example adds image and text (lots of custom background stuff going on).
Example code discussed here:
UIView* container = [[UIView alloc] initWithFrame:goodRect];
UITableView* tv = [[UITableView alloc] initWithFrame:tableRect];
UIButton* btn = [[UIButton alloc] initWithFrame:btnFrame];
[container addSubview:tv];
[container addSubview:btn];
myController.view = container;
Maybe have a look at question UIButton in a UITableView header ignores most touches.
Here's a good tutorial for customizing your tableview cells.
Instead of adding labels (as in the example), you can add any controls.