简体   繁体   中英

Bar Button Item is not Showing

I am trying to create a bottom toolbar. So I dragged I Bar Button Item to the View Controller and it was automatically position at the bottom, see image below:

在此输入图像描述

But when I run the app, it doesn't show the bar at the bottom. 在此输入图像描述

I already added: self.navigationController?.navigationBarHidden = false

I think it's just only a constraints problem. First of all check your Document Outline near to the left of your table, to see the position (toolbar is just below table):

在此输入图像描述

Add your constraints and pay attention to all options as shown in the picture:

在此输入图像描述

Then, take a look to the size inspector, for the table view:

在此输入图像描述

And for the toolbar:

在此输入图像描述

This configuration working both in portrait/landscape mode.

Drag UIToolbar controller directly instead of only UIBarbutton item.

在此输入图像描述

self.navigationController?.navigationBar.hidden=false

Have you set constraints of UIToolbar? I just guess it can be one of the reasons why you cannot see your barbuttoitem.

The navigation bar and the toolbar are two different things and the toolbar is hidden by default. Try setting the toolbar hidden attribute to false.

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