Question

I'm running into an issue where for navigation, we have to use a custom back button, which we are matching to iOS7. So we're creating a UIButton with a background image and then setting it as a custom view of a UIBarButtonItem.

The issue is that when an Action sheet is presented by iOS7, the background is faded. However, the custom button does not and it looks mismatched. Question is - is there a property that can be set to provide the image for the faded state? (though this can be done with delegation, I wanted to see if there was a simpler solution before going that route).

I have tried to set a faded image for UIControlStateDisabled, UIControlStateSystem, UIControlStateReserved with no avail.

Screen shot below:

enter image description here

Was it helpful?

Solution 2

I have actually resolved this issue without delegation. The solution is to have a png with clear background. So just the blue of the back arrow. In that case, iOS handles the fading and desaturating. If you add background, it will not.

OTHER TIPS

I ended up using delegation. When the action sheet is presented, my controller received a message and switched the button to faded. When action sheet was dismissed, my controller again received a messaged and switched button to normal.

Actionsheet was subclassed here, which is why I had to do this dance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top