我有一个问题,我在测试中工作,但现在在一个更大的应用程序中,我似乎无法理清。didSelectRowAtIndexPath问题
我首先有一个有六个按钮,每一个加载我使用的是不同的视图中的视图:
- (IBAction)showInfo2:(id)sender {
InfoViewController *Infocontroller = [[[InfoViewController alloc] initWithNibName:@"InfoView" bundle:nil] autorelease];
Infocontroller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:Infocontroller animated:YES];
}
这似乎是工作的罚款,并加载下一个部分,在这种情况下“的InfoView”。 然后,我加载一个tableview,并从一个xml feed中填充完整的f数据,这又是一个工作,(尽管对我来说不是一件容易的事情!)。
问题出现在我知道尝试和使用时: 似乎没有发生任何事情,即新视图未加载。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here -- for example, create and push another view controller.
SubInfoViewController *subInfoViewController = [[SubInfoViewController alloc] initWithNibName:@"SubInfoView" bundle:nil];
[self.navigationController pushViewController:subInfoViewController animated:YES];
[subInfoViewController release];
}
我知道它被调用,因为这个工程:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *message = [[NSString alloc] initWithFormat:@"You selected a row"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Row Selected" message:message delegate:nil cancelButtonTitle:@"Yes I did" otherButtonTitles:nil];
[alert show];
[message release];
[alert release];
}
任何帮助多人欢迎,并请温柔新手:)
对不起,它的pushview控制器似乎并没有加载新视图。 – jimbo 2010-08-18 08:33:09