2011-02-05 70 views
0

我需要在NSTableView中查看來自NSMutableArray的數據。有代碼:將NSMutableArray設置爲NSTableView的數據源

- (IBAction)StartReconstruction:(id)sender 
{ 
    NSMutableArray *ArrayOfFinals = [[NSMutableArray alloc] initWithObjects:nil]; //Array of list with final images 
    NSString *FinalPicture; 
    NSString *PicNum; 
    int FromLine = [TextFieldFrom intValue]; //read number of start line 
    int ToLine = [TextFieldTo intValue];  //read number of finish line 
    int RecLine; 

    for (RecLine = FromLine; RecLine < ToLine; RecLine++) //reconstruct from line to line 
    { 
     //Start(RecLine); //start reconstruction 

     //Create path of final image 
     FinalPicture = @"FIN/final"; 
     PicNum = [NSString stringWithFormat: @"%d", RecLine]; 
     FinalPicture = [FinalPicture stringByAppendingString:PicNum]; 
     FinalPicture = [FinalPicture stringByAppendingString:@".bmp"]; 
     [ArrayOfFinals addObject:FinalPicture]; // add path to array 
    } 

    NSBeep(); //make some noise 

} 

我需要在我的應用程序中設置ArrayOfFinals作爲我的tableview的數據源。我在可可小白,我不知道我在哪裏需要進行連接:(

我看到YouTube上的教程,但它並沒有HEPL我。

回答

1

SO真的不是換一個地方一步一步的教程。
但對這個問題有很多是你可以在網上找到。就個人而言,我發現apple tutorial非常豐富(即使有點冗長)。

0

你真的不能使用數組直接作爲數據源,但您可以在中間使用一個NSArrayController,然後使用綁定將它們連接起來。

您不需要爲基本設置編寫一行代碼。

網上有很多關於此的一步一步的教程。