오른쪽에 여러 개의 레이블과 3 개의 단추가있는 사용자 지정 UITableViewCell이 있습니다. 스토리 보드에서 프로토 타입 셀을 사용했습니다. 디스플레이는 괜찮지 만 표에서 행을 삭제하기 위해 스 와이프하면 삭제 버튼이 셀 내용 위에 표시됩니다. 나는 이미 2 가지를 시도했다. 스토리 보드 프로토 타입 셀에서 디자인 타임에 contentView를 사용할 수없는 이유는 무엇입니까?UITableView의 삭제 단추가 UITableViewCell 단추를 오버레이합니다.
다양한 자동 크기 조절 마스크 UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
컨트롤이 contentView에 추가됩니다. [self.contentView addSubview : self.buttonView];
사용자 정의 셀 내 코드는 처음에 난 아무것도 추가하지 않은 시간의 파일과 자동 생성 m 파일에서 빈 단지 IBOutlets했지만 지금은 다음과 같은 시도하고 어떤 차이가되지 않습니다- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialize controls
self.accountName.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.accountId.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.offerName.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.offerCode.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.createdDate.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.createdUser.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.orderValue.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.buttonInfo.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.buttonEdit.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
self.buttonView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
// Add controls to Content View
[self.contentView addSubview:self.accountName];
[self.contentView addSubview:self.accountId];
[self.contentView addSubview:self.offerName];
[self.contentView addSubview:self.offerCode];
[self.contentView addSubview:self.createdDate];
[self.contentView addSubview:self.createdUser];
[self.contentView addSubview:self.orderValue];
[self.contentView addSubview:self.buttonInfo];
[self.contentView addSubview:self.buttonEdit];
[self.contentView addSubview:self.buttonView];
}
return self;
}
내 코드 tableview
- (UITableViewCell *)tableView:(UITableView *)tableView2 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"SavedOrderCell";
if ([self.orders count] == 0) {
UITableViewCell *cell = [[UITableViewCell alloc] init];
return cell;
}
else {
SavedOrderCell *cell = (SavedOrderCell*)[tableView2 dequeueReusableCellWithIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.parentVC = self;
[cell.buttonEdit addTarget: self action: @selector(editProduct:) forControlEvents: UIControlEventTouchUpInside];
// Configure the cell.
Order *order = (Order *)[self.orders objectAtIndex:indexPath.row];
cell.accountName.text = order.orderAccount.name;
cell.accountId.text = [NSString stringWithFormat:@"ID: %i", [order.orderAccount.accountId intValue]];
cell.offerName.text = order.orderPromotion.name;
cell.offerCode.text = order.orderPromotion.code;
cell.createdDate.text = [NSDateFormatter localizedStringFromDate:order.createdDate dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterMediumStyle];
cell.createdUser.text = order.createdUser;
cell.orderValue.text = [Common getCurrencyFormattedStringFromNumber:order.orderTotal];
// [cell.buttonStatus setImage:[UIImage imageNamed:[NSString stringWithFormat:@"status_%i", [order.statusId intValue]]] forState:UIControlStateNormal];
UIImageView *bgImage = [[UIImageView alloc] initWithFrame:cell.backgroundView.frame];
bgImage.backgroundColor = [UIColor clearColor];
bgImage.opaque = NO;
if (indexPath.row == 0)
bgImage.init.image = [UIImage imageNamed:@"table_1col_mid_top.png"];
else
{
if (indexPath.row % 2) {
bgImage.init.image = [UIImage imageNamed:@"table_1col_light.png"];
}
else{
bgImage.init.image = [UIImage imageNamed:@"table_1col_mid.png"];
}
}
cell.backgroundView = bgImage;
return cell;
}
}
예 테이블이 스토리 보드에 있습니다. autosize 속성은 어디에 있습니까? 내가 그들을 찾을 수 없습니다. xibode 4.6 –
xib 속성을 사용하고 있습니다. autolayout property.so를 사용하면 자동 크기 조정 property.autolayout이 첫 번째 탭으로 표시되며 관리자는 4 번째 생각입니다 – NHS
모든 자동 레이아웃을 비활성화하고 자동 크기 조정 만 사용할 수 있습니다. 자동 레이아웃없이. 자동 크기 조정을 변경 한 다음 자동 레이아웃을 사용하도록 설정했지만 도움이되지 않았습니다. –