は、私はあなたが私はテーブルビュークラス外のカスタムテーブルビューのセルクラスを作成するために必要な私の場合には、使用しているメソッド名に精通していないですお役に立てば幸いです関連するコード:
テーブルビュークラスで
@implementation QRTypeCell
@synthesize imageView;
@synthesize labelview;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
imageView = nil;
labelview= nil;
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,30,30)];
imageView.contentMode = UIViewContentModeCenter;
[self.contentView addSubview:imageView];
self.contentView.backgroundColor = [UIColor blackColor];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
label.textColor = [UIColor greenColor];
label.backgroundColor = [UIColor blackColor];
label.font = [UIFont systemFontOfSize:17];
self.labelview = label;
[self.contentView addSubview:label];
}
return self;}
そして:あなたはヴァルという識別子フィールドの場所にその中に任意の値を参照し、使用IBで
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
QRTypeCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[QRTypeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];}
CurrentQRCode = (QRCode *)[fetchedResultsController objectAtIndexPath:indexPath];
NSString *icon = CurrentQRCode.parsed_icon;
NSString *string = CurrentQRCode.parsed_string;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
NSString *filePath = [[NSBundle mainBundle] pathForResource:icon ofType:@"png"];
UIImage *image_file = [UIImage imageWithContentsOfFile:filePath];
で、このライン
を置き換えたのですか? – jrturton
@jrturton:これは私のカスタムメソッドです.iはカスタムセル用に作成しました。 – Kiran
_Andどこから電話していますか?あなたのcellForRowAtIndexPathメソッドはどこですか? – jrturton