2011-06-28 48 views
0

我正在執行AQGridView,並且一切進展順利。分配給'readonly'屬性的屬性不允許

但是,現在我得到下面的錯誤。

- (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; 

,但仍然沒有工作。

我下載項目的德如'演員爲Netflix的https://github.com/adrianco/Actors-for-Netflix-on-iPad/

而這種代碼有同樣的問題,當我嘗試建立和預處理器也看不到了。

這個例子不聲明屬性在類文件頭上,我試圖在我的項目上試圖解決這個問題。

有人可以看到有什麼問題?

謝謝!

回答

1

我想你想要@property(nonatomic, retain)但我不是100%確定的。我認爲你應該有兩個工作 - 你有沒有嘗試過一個乾淨的重拍?什麼版本的Xcode?

1

該代碼被設計爲只讀的,如在ActorCell繼承的AQGridViewCell內部所見。僅僅因爲它在GitHub上並不意味着它有效。 reuseIdentifier應該被傳遞給初始值爲UITableViewCell s。這是一個例子。

//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"]; 
}