Xcode:在视图之间切换
问题描述:
我希望能够在视图之间切换。 我一直在写一些代码,但它不工作?Xcode:在视图之间切换
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
AlleRumViewController *allerum = [[AlleRumViewController alloc] initWithNibName:nil bundle:nil];
if ([[tableData objectAtIndex:indexPath.row] isEqual:@"Alle rum"]) {
[self presentModalViewController:allerum animated:YES];
}
}
你们有没有人知道我可以如何切换?
答
- (IBAction)goButtonPressed:(UIButton*) source {
YourNewViewController* someNameController = [[YourNewViewController alloc] init];
[self.navigationController pushViewController:someNameController animated:YES];
[someNameController release];
}
当然,在TableViewController的情况下,您可以将此代码写入didSelectRowAtIndexPath方法。 – Denes
是否有效?它有帮助吗? – Denes