1

I have a pop up window that slides on screen when a certain button is pressed.

This view has a custom look apart from the rest of the app. It has an .xib file as well. I have managed to change the header background color by adding a customClass to the toolbar in IB. I have managed to change the text style of the title text... It took me some time to figure that out. What I had to do was make an IBOutlet from the title item in IB, then apply the changes in my m...like so

 - (void)customizeAppearance
{



//Sets custom text attribures for this views headers text

[_customNavText setTitleTextAttributes:
    [NSDictionary dictionaryWithObjectsAndKeys:
        [UIColor whiteColor], UITextAttributeTextColor,  //sets text color
        [UIColor blackColor], UITextAttributeTextShadowColor, //sets text shadow color
        [NSValue valueWithUIOffset:UIOffsetMake(0, 3)], UITextAttributeTextShadowOffset, //Moves drop shadow by its coordinates
        [UIFont fontWithName:@"Helvetica-Bold" size:27.0], UITextAttributeFont,nil]  //sets text font and size
    forState:UIControlStateNormal];

}

and this function gets called once the view loads. So my text has its own style on this view only. Great.

So, maybe I am getting to picky, but now I want to move the text down a couple pixels.

This is what I did, I added the following code inside the customizeApperance function...

[[UIBarButtonItem appearance] setTitlePositionAdjustment:UIOffsetMake(25.0f, 25.0f) forBarMetrics:UIBarMetricsDefault];

But this does something interesting, it does not move my text down for the UIBarButtonItem I have just applied those styles too, instead it moves the text of the buttons on the nav bar, such as the cancel button.

So how do I move the UIBarButtonItem thats in the middle, containing text for the navigation header, rather than the text of the buttons on the side?

4

1 に答える 1