i have created a tableview default app with xcode.
But:
in AppDelegate a add a function to load the table view on Button press.
self.window.rootViewController = self.navigationController;
that works fine.
in RootViewController a created an array with data, and pass that to the tableview, that works also fine.
in
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"iPad Selected"
message:[NSString stringWithFormat:@"iPad %d", indexPath.row]
开发者_如何转开发 delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
i wont on Press on cell, go back to the mainview and set the Lable of the Button with Text from the Table. Maybe also save the ID (row Index) in a variable.
Need help :)
add another viewcontroller named View2viewController.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
View2viewController *view2 = [[ View2viewController alloc] initWithNibName:@"View2viewController" bundle:nil];
[self.navigationController pushViewController:view2 animated:YES];
[view2 release];
}
精彩评论