2 つの主要なビューを持つアプリケーションを作成しています。1 つ目はメイン画面で、2 つ目は UITableViewController で、ユーザーの履歴を表示するための配列が設定されています。TableView は正常にロードされ、正常に読み込まれます。問題は、メインの View Controller をバックアップして開くときです。私が使用する場合:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
ViewController *myView;
myView = [[ViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:myView animated:YES];
}
ViewController は表示されますが、画面は真っ暗です。
私が使用する場合:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
ViewController *myView;
myView = [[ViewController alloc] initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]];
[self presentModalViewController:myView animated:YES];
}
アプリケーションがクラッシュし、次のように表示されます。
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'ViewController'' * First throw call stack: (0x30f0a88f 0x35fdb259 0x30f0a789 0x30f0a7ab 0x318a434b 0x318123c7 0x316efc59 0x31665c17 0x31670267 0x316701d5 0x3170f59b 0x3170e367 0x317696a7 0x36dc1 0x316de93d 0x31758627 0x3094d933 0x30edea33 0x30ede699 0x30edd26f 0x30e604a5 0x30e6036d 0x3129f439 0x3165acd5 0x3465b 0x34600) terminate called throwing an exception(lldb)
私は iPhone と iPad のアプリケーション プログラミングにまったく慣れていませんが、これはかなり簡単な作業だと思いました。以前に他のアプリケーションでビューを切り替えたことがありますが、これは機能していません。助けてください!!!