Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UITableview编辑/删除-单元格';s的内容不在屏幕上_Iphone_Uitableview - Fatal编程技术网

Iphone UITableview编辑/删除-单元格';s的内容不在屏幕上

Iphone UITableview编辑/删除-单元格';s的内容不在屏幕上,iphone,uitableview,Iphone,Uitableview,全部,, 我正在使用UITableview并尝试实现编辑/删除功能 当我打这个电话的时候 [tblStoreAvail setEditing:TRUE animated:TRUE]; 单元格的内容显示在屏幕外 这些函数永远不会被调用 - (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView

全部,, 我正在使用UITableview并尝试实现编辑/删除功能

当我打这个电话的时候

  [tblStoreAvail setEditing:TRUE animated:TRUE];
单元格的内容显示在屏幕外

这些函数永远不会被调用

- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath

- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

你有两个问题,泰米尔

1) 您需要将表中的“
委托”
”设置为保存这些委托方法的任何对象(可能是视图控制器)。您可以通过编程方式或通过XIB/storyboard中的连接执行此操作

2) 如果您使用的是自定义单元格,则需要调整字体大小以保留所有要显示的数据


如果您没有使用自定义UITableViewCell对象来显示表中的数据,请开始使用它们,以便获得真正想要查看的格式。

如果您使用的是CustUmtableViewCell,请在标签所需的框架中实现以下方法:

- (void)willTransitionToState:(UITableViewCellStateMask)state
{
    [super willTransitionToState:state]; 
if(state == UITableViewCellStateDefaultMask)
    {
        [self.lblLocation setFrame:CGRectMake(13,22,302,21)];
    }
    else if(state == UITableViewCellStateShowingDeleteConfirmationMask)
    {
        [self.lblLocation setFrame:CGRectMake(13,22,245,21)]; 
    }
    else if(state == UITableViewCellStateShowingEditControlMask)
    {
        [self.lblLocation setFrame:CGRectMake(13,22,245,21)]; 
    }
    else
    {
        [self.lblLocation setFrame:CGRectMake(13,22,210,21)];  
    }
}
如果使用默认的TableViewCell,请确保为tableView设置委托,并执行以下操作:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
 yourCustomCell *cell = (yourCustomCell *)[tableView cellForRowAtIndexPath:indexPath];
[cell.lblLocation setFrame:CGRectMake(13,22,302,21)];
    return  YES;
}

而不是将右标签添加为子视图。。将标签设置为accessoryView和EditingAccessoryView。。cell.editingAccessoryView=标签;cell.accessoryView=标签;