Nat*_*han 7 iphone animation uitableview ios
我只是希望单元格用UIColor或背景图像短暂突出显示,然后在用户点击单元格时动画回到未选择状态.我用星号标记了单元格,表明它已被选中,但希望整个单元格能够短暂地突出显示选择.
sha*_*oga 14
在didSelectRowAtIndexPath中添加此行 -
[tableView deselectRowAtIndexPath:indexPath animated:YES];
Run Code Online (Sandbox Code Playgroud)
Pat*_*Pat 14
我认为如果您想要响应选择动画只有一行,所提供的答案是可靠的.
我正在寻找一种方法来同时执行多行,而无需选择和取消选择响应触摸的行.我做了以下事情:
在我的UITableViewController中创建了一个名为"calloutCells"的方法:
- (void)calloutCells:(NSArray*)indexPaths
{
[UIView animateWithDuration:0.0
delay:0.0
options:UIViewAnimationOptionAllowUserInteraction
animations:^void() {
for (NSIndexPath* indexPath in indexPaths)
{
[[self.tableView cellForRowAtIndexPath:indexPath] setHighlighted:YES animated:YES];
}
}
completion:^(BOOL finished) {
for (NSIndexPath* indexPath in indexPaths)
{
[[self.tableView cellForRowAtIndexPath:indexPath] setHighlighted:NO animated:YES];
}
}];
}
Run Code Online (Sandbox Code Playgroud)
请注意,持续时间和延迟不会更改我选择的动画,因为我在setHighlighted上使用内置动画.
当我想从UITableViewController启动高亮/不高亮动画时,我可以同时突出显示第0部分的第3行和第4行,如下所示:
[self calloutCells:[NSArray arrayWithObjects:
[NSIndexPath indexPathForRow:3 inSection:0],
[NSIndexPath indexPathForRow:4 inSection:0], nil]];
Run Code Online (Sandbox Code Playgroud)
希望这有助于其他人!
| 归档时间: |
|
| 查看次数: |
5099 次 |
| 最近记录: |