0
所以我知道這個問題已被問了很多次,但它似乎並沒有爲我工作。我已經嘗試了一切。 ViewController.h推入一個新的表格視圖
@interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
NSMutableArray *tableData;
}
@property (nonatomic, retain) NSMutableArray *tableData;
@end
ViewController.m
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
SubTableView *secondView = [[SubTableView alloc] initWithNibName:@"SubTableView" bundle:nil];
if ([[tableData objectAtIndex:indexPath.row] isEqual:@"Campus"]) {
secondView.selected = 1;
//[subTable setTitle:[tableData objectAtIndex:indexPath.row]];
}
if ([[tableData objectAtIndex:indexPath.row] isEqualToString:@"School"]) {
secondView.selected = 2;
}
if ([[tableData objectAtIndex:indexPath.row] isEqualToString:@"Admissions"]) {
secondView.selected = 3;
//[subTable setTitle:[tableData objectAtIndex:indexPath.row]];
}
if ([[tableData objectAtIndex:indexPath.row] isEqualToString:@"Boarding"]) {
secondView.selected = 4;
}
if ([[tableData objectAtIndex:indexPath.row] isEqualToString:@"Academics"]) {
secondView.selected = 4;
}
if ([[tableData objectAtIndex:indexPath.row] isEqualToString:@"Athletics"]) {
secondView.selected = 5;
}
if ([[tableData objectAtIndex:indexPath.row] isEqualToString:@"Jobs"]) {
secondView.selected = 6;
}
if ([[tableData objectAtIndex:indexPath.row] isEqualToString:@"Donate"]) {
secondView.selected = 7;
}
[self.navigationController pushViewController:secondView animated:YES];
}
我有一個NavigationController成立,雖然我不知道它是否在故事板正確鏈接。 第二個視圖控制器SubTableView我在StoryBoard中設置了它自己的.h和.m控制器。我的標識符是「SubTableView」,但它拒絕推送該視圖。 我能想到的唯一可能的事情是沒有正確地鏈接navigationController。但是我一直無法找到任何可以使用的東西。
如果我把一個斷點時
[self.navigationController pushViewController:secondView animated:YES];
它會擊中它停止。但它不會推動新的觀點。
在你的斷點處,是否定義了'self.navigationController'和'secondView'?他們中的任何一個或兩個都有可能在那個時候是「無」的。 – Dondragmer 2012-04-29 22:12:37