如何将图像添加到ios中uicollectionView单元格的左上角?

Tec*_*ain 10 iphone objective-c uibutton ipad ios

我想在左上角添加按钮UICollectionViewCell.我能够在单元格的左上角添加按钮,但它不会出现在单元格的顶部,而是出现在单元格下方.请告诉我该怎么做?

我使用下面的代码:
在此输入图像描述

_deleteButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, delButtonSize, delButtonSize)];
    _deleteButton.center = CGPointMake(9, 10);
    _deleteButton.backgroundColor = [UIColor clearColor];

    [_deleteButton setImage: [UIImage imageNamed:@"cross_30.png"] forState:UIControlStateNormal];
    [cell addSubview:_deleteButton];

    [_deleteButton addTarget:self action:@selector(deleteRecipe:) forControlEvents:UIControlEventTouchUpInside];
Run Code Online (Sandbox Code Playgroud)

编辑:
我想像这样制作删除图标:
在此输入图像描述

use*_*905 2

您是否尝试将其添加到单元格的内容视图中? [cell.contentView addSubview:_deleteButton];