Using a UITableViewController with a small-sized table?

后端 未结 11 1166
一生所求
一生所求 2020-12-31 05:51

When using a UITableViewController, the initWithStyle: method automatically creates the underlying UITableView with - according to the documentation - \"the correct dimensio

相关标签:
11条回答
  • 2020-12-31 06:19

    I'm not sure why you're creating an additional view controller for your table. However, in your code, I don't see you adding the table view to its parent. You might also try reducing the bounds height until the whole thing appears on screen; once you do that, it may give you insight as to why it's not working the way you expect.

    0 讨论(0)
  • 2020-12-31 06:21

    Check the autoresizingMask and contentMode properties of the UITableView. These can both affect the frame.

    0 讨论(0)
  • 2020-12-31 06:26

    Why not just use a regular UIViewController and create the table manually?

    0 讨论(0)
  • 2020-12-31 06:29

    i fixed this problem by this code

    {
        UIEdgeInsets insets;
        insets.left = 0;
        insets.right = 0;
        insets.top = 0;
        insets.bottom = 60;
        self.tableView.contentInset = insets;
        [self.tableView setScrollIndicatorInsets:insets];
    }
    
    0 讨论(0)
  • 2020-12-31 06:29

    Try:

    self.edgesForExtendedLayout = UIRectEdgeNone;
    
    //This one in case your NavigationController is not Translucent
    self.extendedLayoutIncludesOpaqueBars = NO; 
    

    Hope this helps.

    0 讨论(0)
  • 2020-12-31 06:35

    I had the same problem and I solved it by resizing the tableView in the viewDidAppear function of the UITableViewController. Not the ideal solution but it works.

    0 讨论(0)
提交回复
热议问题