NKJModalSelector 是 UIPickerView 库(鼓掌)在 Swift 中的替代品。您可以使用 UITableView 选择项目。灵感来源于 Etsy 的视图控制器过渡。
NKJModalSelector 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中
pod "NKJModalSelector"
要运行示例项目,请克隆仓库,然后首先从 Example 目录中运行 pod install
。
[NKJModalSelector appearance].shouldTransformScaleDown = YES;
NKJModalSelectorNavigationController *modalNavigationViewController = (NKJModalSelectorNavigationController *)[self.storyboard instantiateViewControllerWithIdentifier:@"NKJModalSelectorNavigationController"];
modalNavigationViewController.parentNavigationController = self.navigationController;
[self.navigationController addChildViewController:modalNavigationViewController];
[self.navigationController si_presentViewControllerToViewController:modalNavigationViewController];
NKJModalSelectorNavigationController
。您可以在 viewController 中使用以下代码关闭它
NKJModalSelectorNavigationController *currentNavigationController;
currentNavigationController = (NKJModalSelectorNavigationController *)self.navigationController;
[currentNavigationController.parentNavigationController si_dismissModalViewWithComplation:^{
// something
}];
nakajijapan, [email protected]
NKJModalSelector 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。