UIBarButtonItem displaced when style changed from plain to Done in iOS 7 - iphone

When I change the bar button style from plain to Done, the button is moving towards the left direction. This is happening only in iOS 7.
In the Interface Builder, I added a UIBarButtonItem to a toolbar and set its style as plain and identifier as custom and an Image. Its width is set as 26.
When the button is clicked I'm changing its style to Done to indicate its in pressed state. In iOS 7 the button position is moving towards the left. Anyone has any clue on this ?

Related

Swift / Set a white background on back button on navigation bar

After a lot of research, i have to resign...
I'm working on Xcode7, and swift.
I have a transparent navigation bar, so when i'm scrolling on the viewcontroller (a map), i would like the back button be more visible, so with a white opaque background.
Any idea to perform that ?
Maybe, just to insert an image as back button.
In your main.storyboard file, click anywhere in the storyboard that is not a viewcontroller, so in the white space. Then in the file inspector, there is property Global Tint that will change the back bar text color. I've looked around for other ways to change it, such as changing the back buttons text color programmatically, and none seem to work. Hope that helps.

UIViewController Nib Layout changes at runtime

Notice the Nib on the left displays a layout with 2 UILabels, 1 UITextView and 2 buttons. The Y coordinate of the buttons changes at runtime. What is causing this and how do I fix it?
Update #1 - Problem goes away when I shift to a iPhone Retina 4-Inch display.
Update #2 SOLVED - Problem goes away when by unchecking 'Autolayout' in the xib properties.
It looks like you're using iOS 6 and a storyboard with the 4-inch "tall" iPhone screen form factor simulated. Assuming you are using Auto Layout, you probably have a constraint added to one or both of the buttons that pins them to the bottom of their superview. When you then run your app on the 3.5" screen iPhone simulator, the buttons appear to "move up" as their superview has gotten shorter than on your storyboard.
Find the button with the icon pictured below while editing your storyboard, and click it to toggle the simulated screen size between the 3.5-inch and 4-inch form factors. You should see your buttons re-layout based on their constraints.
To set your buttons' spacing relative to the top instead of bottom of their superview, select both buttons and from the menu bar choose the Editor menu > Pin > Top Space to Superview. (Or use the Pin button pictured below directly from the storyboard.)
There's a good introductory tutorial to Auto Layout here, if you haven't learned about it yet.

UIToolbar and Flexable/Fixed bar button items

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|

Button icons: round close icon

I've seen other apps are using a round icon for closing a view. The only similar icon I found is UIBarButtonSystemItemStop. But this presents only a rotated cross with a border (as always with buttons) around it.
I rather would like have something like a UIButtonTypeInfoLight. If this button is used, no border is visible. Also the icon is a round grey icon with a symbol (here i symbol) in it. Are there further icons in this style available? Neither UIBarButtonSystemItem nor UIButtonType is offering that.
I have also seen a thunderbolt icon in the style of UIButtonTypeInfoLight. Are these icons self made? If yes, how are they included so that no border is visible?
These buttons are custom.
You can embed any custom view into bar using [UIBarButtonItem initWithCustomView:].
You can use UIButton with UIButtonTypeCustom type so that you have button with no border. Also set showsTouchWhenHighlighted to YES so that button glows like info button.

UIBarButtonItem in middle of navbar?

I have created a flexible navigation bar in my app that will show custom buttons on the left, right, and in the middle. So far I have got working:
Right/Left/Middle - Custom Image and/or Text
Right/Left - Normal looking button with custom Image in it
Right/Left - Normal looking button with custom Text in it
By 'normal looking' I mean the default UIBarButtonItemStyle- just a nice shiny button.
My question is, how can I achieve the same look in the MIDDLE of the nav bar? I can do custom/text images by just creating a custom UIButton, and on the right / left I create a UIBarButtonItem from it, but in the middle I just add the UIButton view as a subview of the navbar.
I can't add a UIBarButtonItem to the navbar as a subview, and any UIButton I create doesn't look like a UIBarButtonItem.
The only workaround I can think of is to use a stretchable custom image that I steal from a screenshot. I'd rather avoid doing it this way. Am I missing something?
*********** UPDATE **************
The open source library Three20 will allow you to create UIButtons that look like UIBarButtonItems. Then you can add them to the bar view either by placing manually as a subview or by setting the title view.
I never understood why they didn't make UIBarButtonItems derive from UIViews (or even better, UIButtons) so they could be used elsewhere.
Sounds like you're on the right track, but need better artwork :-) You can get a large number of iPhone UI components in a Photoshop .PSD file from here. They have pre-rendered bar buttons which you can use as a base for a standard UIButton image. If you have Photoshop (or a decent drawing program) you can stretch the buttons from the middle to fit your size without getting the corners distorted. Just add the label and you should be good to go.
Put a flexible region on the left and right, they will offset each other causing anything between them to be centered