Cocoa touch 如何从UITableViewCell中删除按钮?

Cocoa touch 如何从UITableViewCell中删除按钮?,cocoa-touch,ipad,uitableview,Cocoa Touch,Ipad,Uitableview,我定制了一个UITableViewCell,因为我有一个UILabel和UIButton。我已经在layoutSubviews方法中设置了框架,现在表已经定制了我在三个位置使用的UITableViewCell,但我需要删除第二个位置的UIButton。怎么做 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSSt

我定制了一个
UITableViewCell
,因为我有一个
UILabel
UIButton
。我已经在
layoutSubviews
方法中设置了框架,现在表已经定制了我在三个位置使用的
UITableViewCell
,但我需要删除第二个位置的
UIButton
。怎么做

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    CustomPopTableViewCell *cell = (CustomPopTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    {
        cell = [[[CustomPopTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }

    cell.accessoryType = UITableViewCellAccessoryNone;
    if(tableView.tag == e_metadataView)
    {
        //cell.mCheakMarkButton.frame=CGRectZero;
        cell.mTaggedTerm.text = [docInfoCollection objectAtIndex:indexPath.row];
    }
    else if(tableView.tag == e_searchSettingView)        
    {
        if(indexPath.row == self.currentRow)
        {
            [cell.mcheckMarkButton removeFromSuperView];
        }
        cell.mTaggedTerm.text = [searchEngineCollection objectAtIndex:indexPath.row];
    }
    else if(tableView.tag == e_TaggedTermView)//tageed term table
    {
        TaggedItems *taggedItem = [documentData.taggedWords objectAtIndex : indexPath.row];
        cell.mTaggedTerm.text = taggedItem.keyword;
        if([self isTappedObjectExist:indexPath.row])
        {
            cell.accessoryType = UITableViewCellAccessoryCheckmark;
        }


    }

    return cell;
}
我将使用:

for (UIView* v in cell.subviews) {
    if ([v isKindOfClass:[UIButton class]]) {
        [v removeFromSuperView];
    }
}
当然,如果自定义单元格中有中间级别的视图,则需要进行修改。如果您有多个按钮,我会使用标记来标识它。

它从SuperView中移除,“v”是小的:)