Frage

I have this problem, on iOS 7 the app works fine:

enter image description here

On iOS 6.1 the bar did't work. The space was wrong, the button position and all the objects are displayed on wrong position.

enter image description here

War es hilfreich?

Lösung

The statusbar has changed a lot from iOS7 onwards- you can read about that here: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Bars.html#//apple_ref/doc/uid/TP40006556-CH12-SW1

A better question would be- how do you like your status bar to behave on iOS 6.1 ? Regarding the left bar button item, in order to make the iOS6.1 button look like the iOS7.0 button, you will have to create a custom one- this can be done. e.g. create an arrow image similar to the iOS7 one (I call that "back_arrow.png" in the following code) and write the following if it needs to look like the iOS7.0 button (check for the iOS version before writing the following, write it only for iOS version<7.0)

        UIImage * backButtonImage = [UIImage imageNamed: @"back_arrow.png"];
        [[UIBarButtonItem appearance] setBackButtonBackgroundImage: backButtonImage forState: UIControlStateNormal barMetrics: UIBarMetricsDefaultPrompt];

        [[UIBarButtonItem appearance] setBackButtonBackgroundImage: backButtonImage forState: UIControlStateNormal barMetrics: UIBarMetricsDefaultPrompt];

        NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [UIColor clearColor],
                                    UITextAttributeTextColor,
                                    [UIFont fontWithName:@"HelveticaNeue-Bold" size:14],
                                    UITextAttributeFont,
                                    [UIColor colorWithRed:70.0/255.0  green:120.0/255.0  blue:251.0/255.0 alpha:1.0],
                                    UITextAttributeTextShadowColor, nil];

        NSDictionary *highlightedAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [UIColor clearColor],
                                    UITextAttributeTextColor,
                                    [UIFont fontWithName:@"HelveticaNeue-Bold" size:14],
                                    UITextAttributeFont,
                                    [UIColor colorWithRed:70.0/255.0  green:120.0/255.0  blue:251.0/255.0 alpha:0.7],
                                    UITextAttributeTextShadowColor, nil];



        [[UIBarButtonItem appearance] setTitleTextAttributes: attributes
                                                    forState: UIControlStateNormal];
        [[UIBarButtonItem appearance] setTitleTextAttributes: highlightedAttributes
                                                    forState: UIControlStateHighlighted];
        [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0,0) forBarMetrics:UIBarMetricsDefaultPrompt];
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top