I am trying to create a table using TTTableViewController . I want to display an image in the section title along with the signature text, something similar to what instagram and many other applications do. I tried using a sample from TTNavigatorDemo to display data from TTSectionedDatasource (I'm not sure if this is the right way to do this, please suggest a better way if you know any). It contains section headings / headings like regular rows and data like TTTableViewItem . I tried to implement the <UITableViewDelegate> protocol and reached it using the viewForHeaderInSection method, now the data is separated from the section, is there a better way using Three20 through which I can pass my header / section and TableItemView along the data source, as this would allow me implement TTTableViewDragRefreshDelegate , which I could not implement when implementing the <UITableViewDelegate> protocol in my class.
My class declaration right now looks something like this:
@interface ImageTable : TTTableViewController <UITableViewDelegate> { }
I would like to show section headings with image and text, for example:
:
I am currently using TTNavigatorCode to populate data in my table, which:
self.dataSource = [TTSectionedDataSource dataSourceWithObjects: @"Food" [TTTableViewItem itemWithText:@"Porridge" URL:@"tt://food/porridge"], [TTTableTextItem itemWithText:@"Bacon & Eggs" URL:@"tt://food/baconeggs"], [TTTableTextItem itemWithText:@"French Toast" URL:@"tt://food/frenchtoast"], @"Drinks", [TTTableTextItem itemWithText:@"Coffee" URL:@"tt://food/coffee"], [TTTableTextItem itemWithText:@"Orange Juice" URL:@"tt://food/oj"], @"Other", [TTTableTextItem itemWithText:@"Just Desserts" URL:@"tt://menu/4"], [TTTableTextItem itemWithText:@"Complaints" URL:@"tt://about/complaints"], @"Other", [TTTableTextItem itemWithText:@"Just Desserts" URL:@"tt://menu/4"], [TTTableTextItem itemWithText:@"Complaints" URL:@"tt://about/complaints"], nil];
I was able to do something similar by implementing a method:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { return myCustomView; }
But since my data comes from the model class, and I want my generating views to add it to the data source in a formatted way. I would like to know if there is a way to use Three20 through which I specify an array of my data for partitions and another array for the corresponding data for partitions?
Your help is much appreciated
thanks