UIToolbar and Flexable/Fixed bar button items - iphone

I have a toolbar, where I want to have one UIBarButtonItem centered and have another on the very right. However when I add the button on the right, my centered button gets shifted further to the left (see attached). I can't figure out how to get this resolved without using code (I would like to use interface builder only). Any ideas?

To do this in just IB, add a fixed bar button item to the very left of the bar that's the exact same width of the 'switch camera' button, followed by a flexible button, your camera icon, another flexible space, and the switch camera.
So it would look like:
|--fixed space--||--flexible space--||Camera Button||--flexible space--||switch camera|

Related

Add Buttons to Navigation Bar that are aligned with the Title

So I have this navigation title, and I tried to align some buttons with it using .toolbar. But Whenever I lower it with some extra padding on the top (so that they can be aligned horizontally) the buttons stop being able to be clicked. Is there some kind of area around the navigationTitle where I can't hit buttons? How do I fix this?
You can add views including buttons to the Navigation bar using .naivgationBarItems(leading: View?, center: View?, trailing: View?)

UIBarButtonItem Custom Image is Stretched (Xcode)

I'm creating a side menu in Xcode, and to open it I'm using a navigation view controller like the following:
I need the left bar button item to be on the left.
I added a left bar button item. Without changing it to a custom image, it is aligned to the left, as desired. When I change it to the custom image (the three lines) it stretches and aligns itself in the center. I have not written any code for this view controller yet, so none exists for the bar button item.
How can I get this aligned to the left as it should be? (Above the "Home" text).
Thanks for any help.
This is because your menu icon size is bigger.I have added two images one is with 64*64 px size which is perfect and in another icon with 512*512 px size
Hope it will help.Thank you.
You can’t use any image size for UIKit tab bar or navigation items.
Please read this guideline from Apple:
https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/custom-icons/

How to have a Touch Bar button which is image only?

Adding touch bar buttons into touch bar of macOS, with images of size 80x60, ends up like this:
The button has been scaled to 40x30, but instead of a button filled up by image, it has the left/right padding on the side of button. Is it possible to have actual size of touch bar buttons without the padding?
You have to use Image Button from object library, but you have to include it into the Touch Bar View which you can find in object library.
Output looks like this:

issue occurs when doing in LandscapeLeft

I am working to support the rotation screen in Iphone now and running into the issue. When the screen is in Poitrait mode, the position of navigation bar and its items on it looks perfectly.
When I switch to LandscapeToLeft, the width of navigation bar is stretched and it is fine.However, the position of items bar on it stay the same...Their positions are not changed at all.Therefore, there are huge room from the rightmost button to a right margin. ...I cant not attach any images so that you guys can easily see it....Sorry about that
If you were experiencing it before, please help
Any ideas are welcomed here. Thanks
PS: these itemBarButton are added by drag and drop in the toolbar in StoryBoard
Take a look at adding a "Fixed Space Bar Button Item" or "Flexible Space Bar Button Item". You can drag them into the navigation bar from the object library.

Any way to "pin" something to the bottom for rotation?

I have a view with a button at the bottom of the portrait screen, when I flip to landscape my tableview and everything else adjusts fine, but my button at the bottom is now missing. I can't find a property in IB that would allow me to make the position of that button relative to the bottom of the screen, so that if it flips to landscape then it will still be "5 pixels above the bottom" or whatever.
Any thoughts? Is a toolbar the only way to go here? What about for other controls?
Open Interface Builder and select the button you wish to anchor to the bottom. Choose Tools -> Inspector then click the Ruler icon. In the auto sizing section select the southern most I-Beam.