You need to code a little bit to create a custom cell layout, so I hope you don't scare you.
First, a new subclass of UITableViewCell . Let me call it InLineEditTableViewCell . Your InLineEditTableViewCell.h interface might look something like this:
And your InLineEditTableViewCell.m might look like this:
Next, you configure your UITableView , as usual, in your controller. In this case, you need to implement the protocol method UITablesViewDataSource - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath . Before #import "InLineEditTableViewCell" your implementation for this, remember the #import "InLineEditTableViewCell" in your view controller. After that, the implementation is as follows:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { InLineEditTableViewCell *cell = (InLineEditTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"your-static-cell-identifier"]; if (!cell) { cell = [[[InLineEditTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"your-static-cell-identifier"] autorelease]; }
What is it! You now have custom cells in a UITableView .
Good luck
Kasper K.
source share