2012-06-09 63 views
-3

我在[[c textLabel] setText:item];處獲得了一個線程。我不明白我需要更改以允許我的應用程序運行。線程說:​​線程1:信號SIGABRT。如果需要請幫助,我可以發佈更多信息。不理解線程XCode

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
return [tasks count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

{ 
UITableViewCell *c= [taskTable dequeueReusableCellWithIdentifier:@"Cell"]; 

if (!c) { 
    c = [[ UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"]; 
} 

NSString *item = [tasks objectAtIndex:[indexPath row]]; 
[[c textLabel] setText:item]; 

return c; 

} 
+0

請包括崩潰的全文。可能'item'不是NSString。 – jrturton

回答

0

在線: -

UITableViewCell *c= [taskTable dequeueReusableCellWithIdentifier:@"Cell"]; 

taskTable應由tableView被替換(指向委派的tableView的方法,而不是直接的tableView)

+0

我這樣做,並在同一確切區域得到相同的線程。 – user1438042

+0

看到您未訪問任何對象而沒有實際分配內存。 –

+0

還實現了tableview委託UITableViewDelegate,UITableViewDatasource在接口文件中,並在viewDidLoad設置它自我..(如果它不是一個uiTableViewController,只是一個UITableView)..另請參閱如果您使用xib –

0

嘗試檢查警告。通常在XCode中,警告會提示更多錯誤。

我認爲,錯誤在「c」值。

+0

其線程不是錯誤 – user1438042

+0

@ user1438042:這是一個錯誤 - 你得到了SIGABRT。至於線程的定義:http://en.wikipedia.org/wiki/Thread_%28computing%29 –

+0

發送你的所有警告從這個類請 – CReaTuS