开发者

iPhone make toolbar visible in UITableView

开发者 https://www.devze.com 2023-04-12 06:00 出处:网络
I have a UIT开发者_如何学GoableView has a subview of a UIView and I\'ve added a toolbar on top of the UITableView so it should look like this:

I have a UIT开发者_如何学GoableView has a subview of a UIView and I've added a toolbar on top of the UITableView so it should look like this:

iPhone make toolbar visible in UITableView

However when I actually run it, it looks like this:

iPhone make toolbar visible in UITableView

So for some reason the UIToolBar isn't showing up. I really don't know why, is anybody able to figure this one out? Thanks in advance.

EDIT: I've changed the simulated metrics like suggested and it still does not show up:

iPhone make toolbar visible in UITableView

EDIT2: Here is a list of objects as requested by Raixer.

iPhone make toolbar visible in UITableView


Alright. I have a similar setup in my app so I will show you what I did.

I setup a tab bar controller with navigation controllers in each tab (this gives me the navigation bar automatically that is why I use it). If you notice the View on the first tab is being loaded from another nib (that is what I am assuming you are doing). I did this by changing the view's class to my own view controller and then setting the name of the NIB file to load in the Inspector like this:

iPhone make toolbar visible in UITableView


(source: minus.com)

Then in my other nib file I only have this:

iPhone make toolbar visible in UITableView

I hope this helps.


That's because you configured your nib file without counting with the height of the Tab bar.

The toolbar's height is 49 pixels. So when the view appears all your elements are moved 49 pixels up.

You should got to IB, open your View, go to Attributes Inspector, and in simulated metrics select Tab bar for Bottom Bar.

iPhone make toolbar visible in UITableView


I doubt you will succeed with this approch. UITableViewController is very picky about adding subviews to its UITableView. However, you can have your UITableView handled by a standard UIViewController (just let IB point to a custom class inheritng from UIViewController). Add the table view to the controller's view as a subview and add the toolbar to the outer view. Then you should be able to add subviews. UITableViewController gives you some convinience and functionality. If you can live without, UIViewController is no disadvantage. If you can't, you'll have to implement it yourself.

Another alternative to get the toolbar: put your table into a UINavigationController. That one comes with a toolbar (on top).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号