Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think you used Uppercase letter in the property <strong>Title</strong> . In the array it is simply 'title'</p> <p>Try the below lines of code.</p> <pre><code>- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { return [[events objectAtIndex: section] objectForKey: @"title"]; } </code></pre> <ul> <li><em>If it is not working can you please show us the <code>CalendarModel</code> class</em></li> </ul> <p>One main problem of your implementation is , your header will always display first title as header , Since you have only 1 section </p> <p>If I am rite you need to implement like this </p> <pre><code>#pragma mark - table methods -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return events.count; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { return [[events objectAtIndex: section] objectForKey: @"title"]; } -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CalendarModel* event = events[indexPath.section]; NSString *dato = [[event.time objectAtIndex:0] startTime]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSSzzz"; //formatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:3600]; //formatter.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar]; //formatter.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"en_GB"]; NSDate *gmtDate = [formatter dateFromString: dato]; formatter.dateFormat = @"dd-MM-yyyy HH:mm"; dato = [formatter stringFromDate:gmtDate]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SportCell" forIndexPath:indexPath]; cell.textLabel.text = [NSString stringWithFormat:@"%@", event.title ]; cell.detailTextLabel.text = dato; return cell; } </code></pre>
 

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