1. 程式人生 > >UITableView側滑效果(1)上面文字下面圖片的效果

UITableView側滑效果(1)上面文字下面圖片的效果

mst void sca from des self controls normal clas

//自定義TableviewCell

#import "OrderViewCell.h"

#import "Masonry.h"

@implementation OrderViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

{

self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];

if (self)

{

}

return self;

}

//cell上面view

-(void)layoutSubviews{

[super layoutSubviews];

[self modifiDeleteBtn];

}

//實現上面文字下面圖片

-(void)modifiDeleteBtn{

for (UIView *subView in self.subviews)

{

if ([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]){

//確認訂單

UIView *confirmationView = subView.subviews[3];

confirmationView.backgroundColor = [UIColor colorWithRed:164/255.0 green:225/255.0 blue:225/255.0 alpha:1.0];

for (UIView *view in confirmationView.subviews) {

UIImageView *deleteImage = [[UIImageView alloc] init];

deleteImage.contentMode = UIViewContentModeScaleAspectFit;

deleteImage.image = [UIImage imageNamed:@"confirmOrder"];

deleteImage.frame = CGRectMake(5, -10, 20, 20);

[view addSubview:deleteImage];

UIButton *oneBtn = [UIButton buttonWithType:UIButtonTypeCustom];

oneBtn.frame = CGRectMake(-25, 5, 80, 30);

[oneBtn setTitle:@"確認訂單" forState:UIControlStateNormal];

oneBtn.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:10];

[view addSubview:oneBtn];

}

}

}

技術分享

UITableView側滑效果(1)上面文字下面圖片的效果