나는서브 클래스를 만들어서 3 가지 유형의 이미지 (즉, facebook twitter 및 linkedin)를 생성해야합니다. 것은 내가 어느 입니다 service
라는 클래스에 속성을 추가하려고 그래서 순간 지원 셀 서비스를 알아야한다는 것입니다.UITableView 하위 클래스에 속성 추가
static NSString *sCellIdentifier = @"sCell";
SocialTableViewCell *sCell = [tableView dequeueReusableCellWithIdentifier:sCellIdentifier];
sCell.service = @"service";
if (sCell == nil){
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ExampleView" owner:nil options:nil];
for(id currentObject in topLevelObjects)
{
if([currentObject isKindOfClass:[SocialTableViewCell class]])
{
sCell = (SocialTableViewCell *)currentObject;
break;
}
}
}
if (indexPath.row == 0) {
sCell.serviceImage.image = [UIImage imageNamed:@"icon_Twitter.png"];
sCell.service = @"twitter";
return sCell;
}
나는이 같은 특성으로 설정하려고 : 내가하려고 할 때
sCell.service = @"twitter";
및
이
내가 테이블에 광고 그것을 내 휴대폰을 설정하고 어떻게SocialTableViewCell
클래스의
awakeFromNib
메서드에서 읽습니다. null이 반환됩니다. 이걸 관리하려면 어떻게해야합니까?
:
당신은
service
속성의 setter 메소드를 사용할 수 있습니다. – rckoenes오케이 그래서 어떤 방법을 사용해야합니까? 그것에 대해 읽을 수있는 곳은 어디입니까? –
'service' 속성에 대한 setter 메소드를 생성하고 거기에서 처리 할 수 있습니다. – rckoenes