user858600
user858600

Reputation:

iOS custom UITableView and UITableViewCell with columns (Twitter app)

I'm developing an iPhone/iPod application, and the designer used a lot of these "Twitter App Concepts" (screenshot). As you can see, the TableView has a shadow and the cells can be split in columns (those columns are clickable).

I just need to create those columns, any idea how I can accomplish that?

Upvotes: 1

Views: 1881

Answers (3)

ohmprakash
ohmprakash

Reputation: 123

Use your own subclass of UITableViewCell instead of UItableviewcell. And Customise your cell as you want.

Upvotes: 0

CStreel
CStreel

Reputation: 2642

Well a UITableViewCell is a UIView so in your tableView:cellForRowAtIndexPath: when you hit that row simply add 3 subviews to the UITableViewCell.

There is one downside to this approach though and that is if there are a lot of these "Column Cells" then it will hinder performance. You also tend to want to avoid more then 5 subviews in a UITableViewCell

In case you are wondering "Why can't i just add multiple cells to a Single Row?"

Good question and the reason is UITableView's dequeueReusableCellWithIdentifier: (Reference) this takes an Index Path which is a combination of the Section Number and Row Number the Cell is in.

As it only returns a single cel, it's impossible to return multiple cells (unless you write a custom implementation), but you can return a cell with multiple subviews that has a unique identifier ;)

  1. UITableViewCell Class Reference
  2. UIView Class Reference

Edit: The library that danielbeard linked looks to be a good implementation to use.

Upvotes: 1

danielbeard
danielbeard

Reputation: 9149

The prettykit library is probably a good place to start, as the library is a subclass of UITableViewCell and UINavigationController.

http://cocoacontrols.com/platforms/ios/controls/prettykit

Upvotes: 4

Related Questions