UITableViewCell に動的な UITextView があります。動的 textView に従ってフレームが動的に設定される各セルにボタンがあります。以下に記述されたコードは、以前のバージョンでは完全に機能しますが、iOS7 では苦労しています。これは私の UITableViewCell のクラスです。ボタンは iOS7 でフレームを設定しません。
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
describeLabel = [[UITextView alloc] initWithFrame:CGRectMake(20, 0, 290, 30)];
describeLabel.backgroundColor = [UIColor clearColor];
[describeLabel setFont:[UIFont fontWithName:@"Helvetica" size:10]];
describeLabel.editable = NO;
[self.contentView addSubview:describeLabel];
button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:@"Apply Now" forState:UIControlStateNormal];
button.titleLabel.font = [UIFont fontWithName:@"Helvetica" size:10];
[button setTitleColor:[UIColor colorWithRed:29.0/255.0 green:96.0/255.0 blue:140.0/255.0 alpha:1.0] forState:UIControlStateNormal];
[self.contentView addSubview:button];
}
return self;
}
-(void)updateData:(eServices*)data
{
describeLabel.text = data.eServicesdescription;
[describeLabel sizeToFit];
[describeLabel layoutIfNeeded];
button.frame = CGRectMake(230,height(describeLabel),60,30);
}
関連するヘルプは高く評価されます。