开发者

ios tableview back to main view

开发者 https://www.devze.com 2023-03-17 16:40 出处:网络
i have created a tableview default app with xcode. But: in AppDelegate a add a function to load the table view on Button press.

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];
}

ios tableview back to main view

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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消