ios - 滑动 tableViews(很像日历)

标签 ios swift uitableview

您推荐什么是创建日历中看到的滑动 tableView 效果的最佳方法,您可以在其中在 tableView 之间“滑动”?

目前,我的工作方式是检测滑动手势,然后根据滑动方向重新加载 1 个 tableView。虽然这有效,但看起来并不那么好。我真的想要当他们向右/向左拖动时下一个 tableView 被拖入的效果。

var rightRecognizer: UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: "handleSwipeFrom:")
rightRecognizer.direction = .Right
var leftRecognizer: UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: "handleSwipeFrom:")
leftRecognizer.direction = .Left
self.view.addGestureRecognizer(rightRecognizer)
self.view.addGestureRecognizer(leftRecognizer)


func handleSwipeFrom(gesture: UIGestureRecognizer) {
    println(previousDays.count)

    if let swipeGesture = gesture as? UISwipeGestureRecognizer {


        switch swipeGesture.direction {
        case UISwipeGestureRecognizerDirection.Right:

            //call function to get new data
            self.tableView.reloadData()

        case UISwipeGestureRecognizerDirection.Left:
            //call function to get new data
            self.tableView.reloadData()

            }
        default:
            break
        }

    }

}

最佳答案

要实现这一点,您可以使用 UICollectionView 而不是使用 TableView。

请引用以下引用链接实现UICollectionView;

1) Link 1

2) Link 2

3) Link 3

希望这会有所帮助。

关于ios - 滑动 tableViews(很像日历),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34522871/

相关文章:

ios - 如何处理 SKPaymentTransactionStateDeferred?

ios - 使用快速滑动的 View 创建 pagingmenucontroller

ios - 如何获取 iTunes 连接团队 ID 和团队名称?

ios - 远程数据加载后 swift alamofire show viewcontroller

ios - 无法在 iOS 商店中更新我的应用程序

swift - 为什么 Swift 在闭包函数中使用可选参数时会抛出错误?

ios - DidSelectItemAtIndexPath 不适用于 collectionview

ios - 如何创建自定义委托(delegate)方法,如 tableView cellForRowAtIndexPath 方法,它有 tableView 的争论?

ios - 无法注册 UITableViewCell 的自定义子类

ios - 自定义表格单元格 : Why delete icon appears on the content of the cell view?