我有一個問題,我在測試中工作,但現在在一個更大的應用程序中,我似乎無法理清。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