Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd Image and Caption Text to Three20 Table section using TTSectionedDataSource
    text
    copied!<p>I am trying to create table using <code>TTTableViewController</code>. I want to display an image in the section header along with some caption text, something similar to what instagram and many other application does. I tried using the sample from <code>TTNavigatorDemo</code> to display data from <code>TTSectionedDatasource</code>, (I am not sure if this is the right way to do it, please suggest some better way if you know any). It contains section name/headers as regular strings and data as <code>TTTableViewItem</code>. I tried implementing <code>&lt;UITableViewDelegate&gt;</code> protocol and achieved it using <code>viewForHeaderInSection</code> method, now the data is separated from section, Is there any better way using <a href="http://three20.info" rel="nofollow noreferrer">Three20</a> through which I can pass on my Header/Section view and <code>TableItemView</code> along in a datasource as it would allow me to implement the <code>TTTableViewDragRefreshDelegate</code>, which I was not able to implement when implementing the <code>&lt;UITableViewDelegate&gt;</code> protocol in my class.</p> <p>My class declaration right now, looks something like</p> <pre><code>@interface ImageTable : TTTableViewController &lt;UITableViewDelegate&gt; { } </code></pre> <p>I would like to show section headers with image and text like:</p> <p><img src="https://i.stack.imgur.com/QN9ta.png" alt="Instagram">:</p> <p>I am currently using the <code>TTNavigatorCode</code> to populate the data in my Table which is: </p> <pre><code> self.dataSource = [TTSectionedDataSource dataSourceWithObjects: @"Food" [TTTableViewItem itemWithText:@"Porridge" URL:@"tt://food/porridge"], [TTTableTextItem itemWithText:@"Bacon &amp; 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]; </code></pre> <p>I was able to make something similar by implementing the method:</p> <pre><code>- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { return myCustomView; } </code></pre> <p>But since my data is coming from the Model Class and I want my generate views and add them to datasource in a formatted way. I would like to know if there is a way using Three20 through which I specify an Array of my data for sections and another array for corresponding data under the sections?</p> <p>Your help is highly appreciated</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload