小编stu*_*000的帖子

等到 scrollToRowAtIndexPath 快速完成

我的UITableView单元格比屏幕上的多。当我从我的数据模型收到通知时,我想跳到特定的行并显示一个非常基本的动画。

我的代码是:

 func animateBackgroundColor(indexPath: NSIndexPath) {        
    dispatch_async(dispatch_get_main_queue()) {
        NSLog("table should be at the right position")
        if let cell = self.tableView.cellForRowAtIndexPath(indexPath) as? BasicCardCell {
            var actColor = cell.backgroundColor
            self.manager.vibrate()
            UIView.animateWithDuration(0.2, animations: { cell.backgroundColor = UIColor.redColor() }, completion: {
                _ in

                UIView.animateWithDuration(0.2, animations: { cell.backgroundColor = actColor }, completion: { _ in
                        self.readNotificationCount--
                        if self.readNotificationCount >= 0 {
                            var legicCard = self.legicCards[indexPath.section]
                            legicCard.wasRead = false
                            self.reloadTableViewData()
                        } else {
                            self.animateBackgroundColor(indexPath)
                        }
                })
            })
        }
    }
}    

func cardWasRead(notification: NSNotification) { …
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift

6
推荐指数
1
解决办法
5852
查看次数

标签 统计

ios ×1

swift ×1

uitableview ×1