2014-01-22 49 views
-2

嗨,大家好,我正在嘗試使窗口與視圖控制器(我想就像在.Net GroupBox(修理我,如果我錯了)),我試圖啓動在模擬器上的應用程序,並引發異常。我正在使用故事板。窗口與視圖控制器

@interface ViewController() 

@end 

@implementation ViewController 

-(id)init 
{ 
    self = [super init]; 
    self.arSongsCollection = [[NSMutableArray alloc] init]; 

    _tableView.delegate = self; 
    _tableView.dataSource = self.arSongsCollection; 
    return self; 
} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
    [_arSongsCollection addObject:[[Song alloc] initWithTitle:@"Song" andArtist:@"Artist" andURL:[NSURL URLWithString:@"http://songurl.com/song.mp3"]]]; 

} 

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

@end 
+0

什麼是例外? – SztupY

+0

好的,我解決了它,thanx。 – VladeTsitsiakov

回答

1

瞭解更多關於的tableview數據源,這裏的問題:

_tableView.dataSource = self.arSongsCollection; 

這通常遊戲也應該指向自我

_tableView.dataSource = self; 

,你必須同時實現必要的tableview委託和數據源的方法在視圖控制器類中。

相關問題