cocoa touch - iPhone - How to select and show a single record in Grouped Table View Format -


im making iphone app includes list of sports teams. rootviewcontroller lists teams in table view. when click row want load teamviewcontroller, shows record single team.

the catch im wanting display single teams details in grouped table view style.

this causing me endless issues.

i can't seem work out draw on objects need from. eg need use nsfetchedresultscontroller.

ive implemented core data , can see example of appdelegate , rootviewcontroller bits replicate , parts call in in new teamviewcontroller have me stumped.

to setup cellforrowatindexpath in teamviewcontroller main steps need go through can pull in single selected record , able manipulate , how go laying out grouped table view record.

more broadly im not seeming bits carried forward in each new viewcontroller can make navigation app have many pages, each record drilling in give next pages view.

if bit confused ask me more questions , i'll clarify.

it sounds using master-detail pattern wherein have list of teams in master tableview , detail view shows details of each team. have 1 entity "team."

for master tableview, use nsfetchedresultscontroller fetch , order list of teams.

the detail view controller should have property holds reference single instance of team class (or generic managed object if don't have custom subclass.)

in master view's didselectcellatindexpath: method, set detail view's team property team instance @ indexpath in frc before push detail view onto navigation controller.

you configure grouped table in detail view using simple switch statement 1 case each row in table in turn corresponds property/value of team class/entity. since table displays property/named-values of class , not variable list of many objects, number of rows , sections fixed. if want multiple groups, can nest switch statements. outer switch sections , inner switch rows.

@property (nonatomic,retain) team *currentteam; ... - (void) configurecell:(uitableviewcell *) cell forindexpath:(nsindexpath *) indexpath{     switch (indexpath.section) {         case 0: // first section             switch (indexpath.row) {                 case 0:                     cell.textlabel.text=currentteam.name                     break;                 case 1:                     cell.textlabel.text=currentteam.homecity                     break;                 case 2:                     // , on                     break;         case 1: //second section             //...             break;             }             break;         default:             break;     } } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -