Rotate bar button icons?

Discussion in 'iOS Programming' started by LTX, May 23, 2010.

  1. LTX macrumors regular

    LTX

    Joined:
    Dec 25, 2008
    Location:
    Vancouver, BC, Canada
    #1
    I have an iPad application with UIToolbars on the top and bottom, with UIBarButtonItems in them. I want the icons in the bar buttons to rotate with didRotateFromInterfaceOrientation:. I found a resource for rotating buttons using a CGAffineTransform and the transform property of a UIButton, but UIBarButtonItem does not have that property. Apple does it in the Camera app on iPhone, so I know it's possible in buttons, but maybe not in bar button items. I do not want the toolbars to move on device rotation.

    Right now I'm in the process of trying it with a UIButton. How do I detect when the device orientation has changed without returning YES in shouldAutorotateToInterfaceOrientation:? If I have YES in there for other orientations, the toolbars move to landscape positions, but I am able to get the state change from didRotateFromInterfaceOrientation:. If I return NO, I don't get anything from didRotateFromInterfaceOrientation: because the user interface does not rotate.

    Any help would be appreciated.

    Thanks.
     
  2. LTX thread starter macrumors regular

    LTX

    Joined:
    Dec 25, 2008
    Location:
    Vancouver, BC, Canada
    #2
    I managed to get it working with a UIButton, but I want it to look like the UIBarButtonItems I already have, with the gray tint from the toolbar. Is there any way to do this?
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    It might be possible by using UIBarButtonItem's customView property.
     

Share This Page