2011-07-01 16 views
1

付属のサンプルに基づいてAQGridViewを実装しています。しかし、私はxibsで働いている、との例では、コードは次のとおりです。AQGridView:セルを初期化する方法

if (plainCell == nil) 
     { 
      plainCell = [[[ImageDemoGridViewCell alloc] initWithFrame: CGRectMake(0.0, 0.0, 200.0, 150.0) 
               reuseIdentifier: PlainCellIdentifier] autorelease]; 
      plainCell.selectionGlowColor = [UIColor blueColor]; 
     } 

     plainCell.image = [UIImage imageNamed: [_imageNames objectAtIndex: index]]; 

     cell = plainCell; 

    } 

私のコードは次のようになります。

- (AQGridViewCell *) gridView: (AQGridView *)inGridView cellForItemAtIndex: (NSUInteger) index 
    { 


static NSString * FilledCellIdentifier = @"FilledCellIdentifier"; 

AQGridViewCell * cell = nil; 

MagazineCell * filledCell = (MagazineCell *)[gridView dequeueReusableCellWithIdentifier: FilledCellIdentifier]; 

if (filledCell == nil) { 


} 

filledCell.edicaoLabel.text = [[data objectAtIndex:index] name]; 

cell = filledCell; 

return (cell); 

}

例InitWith CGRectが、どのように初期化私はxibsで作業するときのセルですか?

答えて

1

一般的に言えば、XIBから読み込むときには表示されません。実際には、UITableView(UITableViewCellの代わりにAQGridViewCellを使用しています)で行うif(filledCell == nil)の内部でも同じことを行います。したがって、 "GridCell.xib"にファイル所有者としてのAQGridViewControllerがあり、tempCellがIBのレイアウトされたGridCellにバインドされていて、識別子をfilledCellIdentiferに設定した場合、次のようにすることができます:

関連する問題