0

エラーが発生します

スレッド1:シグナルSIGABRT

これはコードです

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

    /* FOR SIMPLE CELL */
    static NSString *MyIdentifier = @"MyCell";

    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];


    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    word *worddc = [Array objectAtIndex:[indexPath row]]; //ERROR thread 1 signal SIGABRT

        cell.textLabel.text = worddc.word_alphabet;



    return cell;
}
4

3 に答える 3

0

この方法を試して、strObj で何が取得されているかを確認してください。文字列ですか?

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

    /* FOR SIMPLE CELL */
    static NSString *MyIdentifier = @"MyCell";

    UITableViewCell *cell=(UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (cell==nil) 
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];

    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    word *worddc = [Array objectAtIndex:[indexPath row]]; //ERROR thread 1 signal SIGABRT
    NSString *strObj=worddc.word_alphabet;
    cell.textLabel.text =strObj;//Here check what you are getting by setting breakpoint.
    strObj=nil;



    return cell;
}
于 2012-10-17T08:54:12.823 に答える
0

次のリストを確認してください。

  • 配列がまだ割り当てられていて、割り当てが解除されていないかどうかを確認してください。
  • 次のように値をキャストしてみてください。

    word *worddc = (word *)[Array objectAtIndex:[indexPath row]];
    
于 2012-10-17T08:08:17.650 に答える
0

問題を説明する必要があるとコメントしましたが、とにかくアイデアがあるかもしれません:

objectAtIndex:(id)オブジェクトを返します。結果を word* にキャストしてみてください:

word *worddc = (word*)[Array objectAtIndex:[indexPath row]];
于 2012-10-17T08:08:33.000 に答える