如何使用Swift使用UITabBar或Segment Control创建PageView?
我是iOS的新手。 我有一个问题,无法得到实施的确切想法。 我在这里上传了两张图片,所以请建议我如何使用Swift实现它。
这是我的图片:
在图像中,您可以看到,对于单个viewController,有两个选项卡,一个是“YOUR GROUP”,另一个是“SHARED BY”。 在那我也有一个tableView。 我为“你的团队”创建了两个自定义UITableViewCell,另一个为“SHARED BY”创建了一个。
实际上基本的想法我知道使用UIPageViewController我可以实现但是对于标签栏我必须做什么。
以下是我的自定义单元格的代码:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if(1 == tagTableView) { var groupSharedByCell = tableView.dequeueReusableCell(withIdentifier: "GroupSharedByCell") as? GroupSharedByCell if (nil == groupSharedByCell) { var nib:Array = Bundle.main.loadNibNamed("GroupSharedByCell", owner: self, options: nil)! groupSharedByCell = nib[0] as? GroupSharedByCell } groupSharedByCell?.selectionStyle = UITableViewCellSelectionStyle.none //cell. return groupSharedByCell! } else { var yourGroupCell = tableView.dequeueReusableCell(withIdentifier: "YourGroupCell") as? YourGroupCell if (nil == yourGroupCell) { var nib:Array = Bundle.main.loadNibNamed("YourGroupCell", owner: self, options: nil)! yourGroupCell = nib[0] as? YourGroupCell } yourGroupCell?.selectionStyle = UITableViewCellSelectionStyle.none //cell. return yourGroupCell! } }
这些单元格是完美的,但使用UITabBar和UIPageViewController如何才能获得确切的要求? 或者有其他选择吗?