简体   繁体   中英

How to center a UITableView in a UIView

My table has about 5 items. The table, which is created through IB, appears at the top of view.. How would I center the UItableView such that it appears lower (example: http://i.stack.imgur.com/G9QoS.png )

Thanks

Edit: Answer is to modify the frame and assign it a CGRect in viewDidAppear method

self.menuitems.frame=CGRectMake(self.menuitems.frame.origin.x,200.0,self.menuitems.frame.size.width,self.menuitems.frame.size.height);

Thanks to AAAAAAAAA and slev

For better way you can directly modify the frame of the tableView. like

tableView.frame=CGRectMake(your frame dimensions what ever you want );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM