【问题标题】:UINavigationController did't works on iOS7 like on iOS6.1 simultaneousUINavigationController 不能像在 iOS6.1 上一样在 iOS7 上同时工作
【发布时间】:2013-10-25 08:06:40
【问题描述】:

我有这个问题,在 iOS 7 上该应用运行良好:

在 iOS 6.1 上,该栏不起作用。空间错误,按钮位置和所有对象显示在错误位置。

【问题讨论】:

  • 如果可能显示两个版本的屏幕截图。

标签: ios uinavigationcontroller position ios7 ios6.1


【解决方案1】:

从 iOS7 开始,状态栏发生了很大变化——你可以在这里阅读:https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Bars.html#//apple_ref/doc/uid/TP40006556-CH12-SW1

一个更好的问题是——你希望你的状态栏在 iOS 6.1 上的表现如何? 关于左侧栏按钮项,为了使 iOS6.1 按钮看起来像 iOS7.0 按钮,您必须创建一个自定义项 - 这可以做到。例如创建一个类似于iOS7的箭头图像(我在下面的代码中称之为“back_arrow.png”)如果它需要看起来像iOS7.0按钮,请编写以下内容(在编写以下内容之前检查iOS版本,编写它仅适用于 iOS 版本

        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];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-02
    • 1970-01-01
    • 2013-09-29
    • 2014-01-26
    • 1970-01-01
    • 1970-01-01
    • 2015-02-11
    • 1970-01-01
    相关资源
    最近更新 更多