0

私は AQGridView の実装を行っており、すべてが順調に進んでいました。

しかし、今では以下のエラーが発生しています。

- (AQGridViewCell *) gridView: (AQGridView *)inGridView cellForItemAtIndex: (NSUInteger) index;
  {
MagazineCell *cell = (MagazineCell *)[inGridView dequeueReusableCellWithIdentifier:@"cell"];
if (!cell) {
    cell = [MagazineCell cell];
    cell.reuseIdentifier = @"cell";
            //Assigning to property with 'readonly' atribute not allowed
}
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = AQGridViewCellSelectionStyleGlow;


cell.edicaoLabel.text = [[edicoesArray objectAtIndex:index] name];
    cell.dataLabel.text = [[edicoesArray objectAtIndex:index] name];

return cell;
}

私はヘッドファイルでこれをやろうとしました

@property(nonatomic, readwrite) NSString * reuseIdentifier;

私も試しました

@property(nonatomic, assign) NSString * reuseIdentifier;

しかし、まだ仕事はありません。

プロジェクト「Actors for Netflix」のサンプルをダウンロードしましたhttps://github.com/adrianco/Actors-for-Netflix-on-iPad/

そして、このコードをビルドしようとすると同じ問題が発生し、プリプロセッサもそれを確認します。

この例では、クラス ファイルのヘッダーでプロパティを宣言していません。問題を解決するためにプロジェクトで試しました。

誰かが問題が何であるかを見ることができますか?

ありがとう!

4

2 に答える 2

1

このコードは、ActorCell の継承元であるAQGridViewCell内で読み取り専用になるように設計されています。GitHub にあるからといって、それが機能するとは限りません。reuseIdentifier は、UITableViewCells の初期化子に渡す必要があります。ここに例があります。

//MagazineCellCode
+(MagazineCell*)cellWithReuseIdentifier:(NSString*)identifier
{
    MagazineCell *cell = [[[MagazineCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
    //Any custom configuration here
    return cell;
}

//TableView Code
if (!cell) {
    cell = [MagazineCell cellWithReuseIdentifier:@"cell"];
}
于 2011-06-28T14:01:02.270 に答える
0

あなたは望んでいると思います@property(nonatomic, retain)が、100%確実ではありません。あなたが持っているものの両方が機能するはずだと思います-クリーンとリメイクを試しましたか? Xcodeのバージョンは?

于 2011-06-28T13:43:30.780 に答える