简体   繁体   中英

reposition UITableViewCellAccessoryCheckmark

I have a Custom UITableViewCell (no tableview only the cell entrierly on its own in a UIView class), I can get the UITableViewCellAccessoryCheckmark to display normally in the UITableViewCell however I am woundering if there is a way to bring it in form the edge a little?

this is how I am setting my accessory type.

selectAllCell.accessoryType = UITableViewCellAccessoryCheckmark;

Make a subclass of UITableViewCell, and then create your own accessoryView.

In your CustomTableViewCell:

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
        view.backgroundColor = [UIColor redColor];
        self.accessoryView = view;
    }
    return self;
 }

由于您没有使用UITableView,因此请创建自己的UIView并添加自己的选中图标,然后将其放在您喜欢的位置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM