Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.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
iOS UITableViewCell标题在编辑时完全滑出视图_Ios_Ios7_Uitableview - Fatal编程技术网

iOS UITableViewCell标题在编辑时完全滑出视图

iOS UITableViewCell标题在编辑时完全滑出视图,ios,ios7,uitableview,Ios,Ios7,Uitableview,我有一个简单的UITableView 我正在做我的第一个编辑实现,添加删除功能。显然,这些东西大部分是默认的。几乎我添加到控制器中的唯一方法是 - (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { Program *victim

我有一个简单的
UITableView

我正在做我的第一个编辑实现,添加删除功能。显然,这些东西大部分是默认的。几乎我添加到
控制器中的唯一方法是

- (void) tableView:(UITableView *)tableView
    commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
    forRowAtIndexPath:(NSIndexPath *)indexPath
{
    Program *victim = Site.current.sortedPrograms[indexPath.row];
    [Site.current removeProgram: victim];
    [self.tableView
        deleteRowsAtIndexPaths: @[indexPath]
        withRowAnimation:UITableViewRowAnimationAutomatic];
}
当我点击编辑按钮时,我看到

这很好。但当我按下一个标题较短的按钮时,我看到了以下内容

标题已完全从网站中滚出!类似地,如果我使用iOS 7向左滑动手势,即使在较长的标题上,标题也会滚动到看不见的位置:

我用来创建单元格的代码非常简单:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"ProgramCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    Program *program = Site.current.sortedPrograms[indexPath.row];
    cell.textLabel.text = program.name;
    cell.detailTextLabel.text = [program.script prettyCycleDuration];
    return cell;
}
这不是我希望我的用户看到的。我宁愿看到它只在必要时滚动标题,以便上下文(而不是空格)与删除按钮相关联。我只是在使用一个stock
UITableViewCell
(不是子类),我正在将“style”设置为Subtitle。我已经看过委托方法,还有一本书,但是我没有看到任何东西说明如何处理这个问题。有办法吗?我需要做我自己的Cell子类并更明确地处理状态吗?或者我还能做些什么

更新
即使转换为自定义子类,并为我的计算单元提供基于约束的布局,它仍然会滑动整个视图,而不是压缩视图。

遗憾的是,这是苹果公司关于良好UI的想法。在iOS 7测试版期间,我在这个问题上提出了一个bug。我猜,通过自定义子类和一些额外的工作,我可以得到更好的东西。我已经做了很多次了,从来没有遇到过问题。我唯一需要知道的是,您必须向cell.contentView而不是cell添加任何视图。你能把你的手机发到邮箱吗method@user2891327已更新以包含该问题。该问题不在CellForRowatineXpath中。奇怪的在返回手机前尝试一下。[cell.textlab removeFromSuperview];[cell.detailTextLabel removeFromSuperview];[cell.contentView addSubview:cell.textlab];[cell.contentView addSubview:cell.detailTextLabel];