If you are sub-classing the UITableViewCell you can adjust it in layoutSubviews
- (void)layoutSubviews {
[super layoutSubviews];
CGRect accessoryViewFrame = self.accessoryView.frame;
accessoryViewFrame.origin.x = CGRectGetWidth(self.bounds) - CGRectGetWidth(accessoryViewFrame);
self.accessoryView.frame = accessoryViewFrame;
}
OTHERWISE......
Add a subview instead of accessoryView
UIButton *indicatorBtn = [UIButton buttonWithType:UIButtonTypeCustom];
indicatorBtn.frame = CGRectMake(cell.contentView.frame.size.width-55, 2, 50, 50);
[indicatorBtn setBackgroundImage:[UIImage imageNamed:@"right_indicator.png"]
forState:UIControlStateNormal];
indicatorBtn.backgroundColor = [UIColor clearColor];
//indicatorBtn.alpha = 0.5;
indicatorBtn.tag = indexPath.row;
[indicatorBtn addTarget:self action:@selector(method:)
forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:indicatorBtn];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…