iphone - trouble with section headers in UITableView -


im having problem setting section headers in uitableview, simple cant work out.

instead of displaying different headers different sections displays same header each section

help me please :)

    - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     worldcupappdelegate *appdelegate = [uiapplication sharedapplication].delegate;      return [appdelegate.matchfixtures count]; }  - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section {       worldcupappdelegate *appdelegate = [uiapplication sharedapplication].delegate;     fixtures *fixtures = [appdelegate.matchfixtures objectatindex:section];      return fixtures.matchdate;  } 

your original code looks okay. i'm betting appdelegate.matchfixtures doesn't contain data think does. modify code this:

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {   worldcupappdelegate *appdelegate = [uiapplication sharedapplication].delegate;    nslog(@"appdelegate.matchfixtures.count = %i", appdelegate.matchfixtures.count);    return [appdelegate.matchfixtures count]; }  - (nsstring *)tableview:(uitableview *)tableview  titleforheaderinsection:(nsinteger)section {    worldcupappdelegate *appdelegate = [uiapplication sharedapplication].delegate;   fixtures *fixtures = [appdelegate.matchfixtures objectatindex:section];    nslog(@"for section %i, fixtures.matchdate = %@", section, fixtures.matchdate);    return fixtures.matchdate; } 

and @ log output in debug console.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -