ios - Cannot navigate to new view controller by tap to cell of searchResultTable -


i new objective c. have table search bar. my problem when tap cell in searchresulttable @ first time, navigated view controller, when canceled search , did again , tap search result cell, nothing happened. can me solve this? here of code :

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     [tableview deselectrowatindexpath:indexpath animated:yes];      uiviewcontroller *newview = [[uiviewcontroller alloc] init];     if(tableview == self.tableview) {         [self.navigationcontroller pushviewcontroller:newview animated:yes];         newview.title = [[listofgroups objectatindex:indexpath.section] objectatindex:indexpath.row];     }     if(tableview == self.searchdisplaycontroller.searchresultstableview) {         [self.navigationcontroller pushviewcontroller:newview animated:yes];         newview.title = [[searchdata objectatindex:indexpath.section] objectatindex:indexpath.row];     }      [newview release]; } 

and here code in viewdidload method

searchdisplaycontroller.delegate = self; searchdisplaycontroller.searchresultsdatasource = self; self.searchdisplaycontroller.searchresultstableview.delegate = self; 

and can clarify me how 3 lines of code above work, 's mean? thank you.

each table view in application needs have delegate , datasource associated it.

the datasource implements uitableviewdatasource protocol, consists of number of methods define title information, how many rows of data displayed, how data divided different sections and, importantly, supplies table view cell objects displayed.

the delegate implements uitableviewdelegate protocol , provides additional control on appearance , functionality of table view including detecting when user touches specific row, defining custom row heights , indentations , implementation of row deletion , editing functions.

source: http://www.techotopia.com/index.php/creating_a_simple_iphone_table_view_application#the_table_view_delegate_and_datasource


Comments

Popular posts from this blog

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

xslt - Umbraco and EXSLT sets do not work -

php - How can I merge Nodes & Webform Submissions into instances of one general Content Type in Drupal 6? -