Swift - 顶层UITableView上的UIPageView重叠

时间:2015-08-18 14:49:56

标签: ios swift uitableview uipageviewcontroller overlapping

我有一个视觉重叠问题我需要帮助。我在Tab Bar Controller中有一个UITableViewController。我在同一个类中创建了一个登上UIPageViewController:

override func viewDidLoad() {
    super.viewDidLoad()
   returnButton.enabled = false
    onBoardingButton.hidden = false
    if (loggedInUser.login == "" || loggedInUser.password == ""){
        onBoarding()
    }
    else {
        workouts = loggedInUser.workouts
        self.tableView.reloadData() //refresh the table with the data
    }
}

func onBoarding(){
    returnButton.enabled = true
    onBoardingButton.hidden = true
    createPageViewController()
    }

我是从UITableViewController.viewDidLoad()调用,以防用户第一次进入应用程序。我遇到的问题是UIPageViewController显示在UITableViewController的顶部,但表中的行与UIPageViewController重叠。

代码:

private func createPageViewController() {
    self.pageViewController = self.storyboard?.instantiateViewControllerWithIdentifier("PageViewController") as! UIPageViewController
    self.pageViewController.dataSource = self
    let startVC = self.viewControllerAtIndex(0) as PageContentViewController
    let viewControllers = NSArray(object: startVC)
    self.pageViewController.setViewControllers(viewControllers as? [UIViewController], direction: UIPageViewControllerNavigationDirection.Forward, animated: true, completion: nil)
    self.pageViewController.view.frame = CGRectMake(0, 30, self.view.frame.width, self.view.frame.height - 60)
    self.addChildViewController(self.pageViewController)
    self.view.addSubview(self.pageViewController.view)
    self.pageViewController.didMoveToParentViewController(self)
}

用于创建pageviewcontroller的私有方法:

PS C:\Users\Adil> 
gc C:\Temp\a.txt
$date = "10:34:31 AM"
select-string -path C:\temp\a.txt -Pattern $date | % {$_.matches.groups.value}




Tuesday, August 18, 2015 10:32:58 AM
Tuesday, August 17, 2015 10:34:31 AM
Tuesday, August 16, 2015 10:34:32 AM
Tuesday, August 18, 2015 10:34:31 PM
Tuesday, August 18, 2015 11:34:31 AM
Tuesday, August 18, 2015 12:34:31 AM
Tuesday, August 18, 2015 13:34:31 AM


10:34:31 AM

不需要的结果: enter image description here

另一方面,当我从一个按钮调用onBoarding()时,它工作正常: enter image description here

知道我做错了什么吗? 提前谢谢

0 个答案:

没有答案