How to create PageView with UITabBar or Segment Control using Swift?

*爱你&永不变心* 提交于 2019-12-11 07:28:28

问题


I am quite new in iOS. I have a problem and not able to get the exact idea for implementation. I am uploading two images here, so please suggest me how can I implement it using Swift.

Here is my images:

In Images you can see that for a single viewController there is two tabs one is "YOUR GROUP" and another one is "SHARED BY". In that I have a tableView also. I have created two custom UITableViewCells one for "YOUR GROUP" and another one for "SHARED BY".

Actually basic idea I know that using UIPageViewController I can implement but for tab bar what I have to do.

Here below is the code for my custom cells:

 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!
    }
}  

These cells are perfect, but using UITabBar and UIPageViewController how can I get the exact requirement? Or is there any alternative?

来源:https://stackoverflow.com/questions/41852780/how-to-create-pageview-with-uitabbar-or-segment-control-using-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!