The text of the shadow navigation button is not displayed. Ios 7

I still updated the back button element in the navigation bar of the application to look in iOS 7, like it was in iOS 6, but I can’t get a text shadow to display in iOS 7.

iOS 7: enter image description here

iOS 6: enter image description here

(bias was done more for testing)

code:

    UIButton *backButton = [[UIButton alloc] initWithFrame: CGRectMake(0, 0, 80.0f + width_offset, 30.0f)];
    UIImage *buttonImage = [[UIImage imageNamed:@"navigation_back_btn"]  resizableImageWithCapInsets:UIEdgeInsetsMake(5, 15, 5, 5)];
    [backButton setBackgroundImage:buttonImage  forState:UIControlStateNormal];
    [backButton setTitle:title forState:UIControlStateNormal];
    [backButton.titleLabel setFont:[UIFont defaultFontWithType:kFontBold andSize:12]];
    [backButton.titleLabel setTextColor:[UIColor whiteColor]];
    [backButton.titleLabel setShadowColor = [UIColor blackColor]];
    [backButton.titleLabel setShadowOffset:CGSizeMake(5.0f, 5.0f)];
    [backButton addTarget:viewController action:@selector(popBack) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    viewController.navigationItem.leftBarButtonItem = backButtonItem;

I would also like to move the button to the left, but this is much less important.

+4
source share
1 answer

Try adjusting the color of the shadow title on the very one UIButton:

[backButton setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];
+4
source

All Articles