サブビューとしてUItableViewを持つ別のビューコントローラーをトリガーする他のビューコントローラーがあります私のコードは2つのファイル.h、.mに従っています
このコードで単一ビューベースのアプリケーションを使用すると正常に動作しますが、たとえば2つのビューを使用すると、最初はlogingscreenで、これを使用して2番目のnibファイルを呼び出します
Viewcomment *b=[[SimpleTableViewController alloc] initWithNibName:@"SimpleTableViewController" bundle:nil];
[self presentModalViewController:b animated:YES];
また
self.window= [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[Viewcomment alloc] initWithNibName:@"Viewcomment" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
「SIGABRT」と表示されます!!! どこが間違っていますか?
.h ファイル:
#import <UIKit/UIKit.h>
@interface SimpleTableViewController : UIViewController <UITableViewDelegate,UITableViewDataSource>{
NSArray *listData;
}
@property(nonatomic, retain) NSArray *listData;
@end
.m ファイル
#import "SimpleTableViewController.h"
@implementation SimpleTableViewController
@synthesize listData;
- (void)viewDidLoad {
NSArray *array = [[NSArray alloc] initWithObjects:@"iPhone", @"iPod", @"iPad",nil];
self.listData = array;
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
}
- (void)dealloc {
}
#pragma mark -
#pragma mark Table View Data Source Methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.listData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
if (cell == nil) { cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] ;
}
NSUInteger row = [indexPath row]; cell.textLabel.text = [listData objectAtIndex:row]; return cell;
}
@end