English 中文(简体)
iOS - UITableView - 取消删除行 - 按钮动画只工作辅助视图
原标题:iOS - UITableView - cancel delete row - button animation works only accessory view is present

<强度 > 概览(已审)

我有UITableView, 当我浏览时,删除按钮出现, 当我碰其它地方时,删除按钮就消失了, 没有任何动画。

< 坚固 > 有辅助 < /强 >

  • If I add an accessory (Disclosure Indicator), when the delete is cancelled, the delete button vanishes with animation.

无辅助 < passotry (无辅助) < parg > (无辅助) < parg > (无辅助) < parg > (无辅助 )

  • If I remove the accessory from the table view cell, then delete cancellation doesn t show any animation.

<强问/强>

  • I don t want the accessory but i want the delete cancellation animation, is there a way to achieve this ?
最佳回答

在 iOS 6 上, 这个“ 错误” 仍然存在。 有两种方法可以解决这个问题:

Solution 1:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //[...]
    cell.accessoryView = [UIView new];
    //[...]
}

Solution 2

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.accessoryView = [UIView new];
}

这样当“ 取消行” 取消时, 按钮会随着动画而消失 。

问题回答

如果您没有使用单元格. textlabel 属性, 请尝试将其设置为某物, 然后隐藏它 。

cell.textlabel.text = @"something";
Cell.textlabel.hidden = YES;

它应该有效





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签