iOS - UITableView in UIVIewController doesn't display all rows [Swift]

前端 未结 2 1092
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 10:48

I\'m facing a bug with my UITableView in UIViewController. I\'ll try to explain what\'s the situation and my problem.

I have a TabBar

相关标签:
2条回答
  • 2021-01-14 10:58

    Sorry about the long time without feedback.

    I have finally found a solution to my problem. I embedded my UIViewController which contains the UITableView in a UINavigationController. After a few researchs, it seems to be the good hierarchy for this case.

    Hope this will help somebody helse. :)

    0 讨论(0)
  • 2021-01-14 11:16

    Ever since MainStory boards came out I'm not a big fan of it, I had the same error the other night, I had to get rid of my View Controller and make a View Controller out of a .xib file.

    • I delete the ViewController from my porject
    • Then I went to the AppDelagate and added a variable to create my own ViewController
      var viewController: ViewController?
    • Under the didFinishLaunchingWithOptions: function before the return

    • I added the following code
      self.window = UIWindow(frame:UIScreen.mainScreen().bounds) self.viewController = ViewController(nibName:"ViewController",bundle:nil) var navController = UINavigationController(rootViewController: self.viewController!) navController.navigationBarHidden = true self.window?.rootViewController = navController self.window?.makeKeyAndVisible()

    Basically after drawing the window frames we created the ViewController and embed it in a navigation controller, then sets the navigation controller as the root view of the window.

    • So then you have to create a xib file File > New > File choose IOS/User Interface; name it ViewController and create. After you can add the UITableView Controller and everything should work fine.
    0 讨论(0)
提交回复
热议问题