0

私のアプリには、上部にナビゲーションコントローラーを備えたビューコントローラーがあります。ナビゲーション バーのタイトルは「パスワードを忘れた」です。このタイトルは、iOS 5 と 6 では改行なしで表示されていました。しかし、iOS 7 で同じアプリを実行すると、ナビゲーション バーのタイトルの末尾にドットが表示されます - 「Forgot Passw…」 この欠陥を修正する唯一の方法は、ナビゲーション バーのタイトルのサイズを縮小します。

誰かが私にどうすればよいか教えてもらえますか? この目的専用の iOS 7 の API はありますか。このView Controllerだけで、ナビゲーションバーのタイトルのフォントサイズを小さくすることはできますか? どんな提案でも大歓迎です。前もって感謝します。

4

4 に答える 4

2

私は自分のプロジェクトとその作業で次のコードを使用しました:

/* ios 7 Change */
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
    {
        //self.edgesForExtendedLayout = UIRectEdgeNone;
        //self.automaticallyAdjustsScrollViewInsets = NO;
        [[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x4B678B)];
        NSShadow *shadow = [[NSShadow alloc] init];
        shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
        shadow.shadowOffset = CGSizeMake(0, 1);
        [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                               [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
                                                               shadow, NSShadowAttributeName,
                                                               [UIFont fontWithName:@"Helvetica Neue" size:21.0], NSFontAttributeName, nil]];
        // self.navigationController.navigationBar.barTintColor = [UIColor blueColor];
        //[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
        [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

    }
于 2013-10-18T13:29:28.287 に答える
0

iOS7以降、私はいつも次のようにしています:

[[UINavigationBar appearance] setTitleTextAttributes:
    [NSDictionary dictionaryWithObjectsAndKeys:
        [UIFont fontWithName:@"Helvetica-Bold" size:SIZE_YOU_LIKE],NSFontAttributeName,
        nil]];

KeywordUITextAttributeFontは iOS7 から落ち込んでいます NSFontAttributeName

SIZE_YOU_LIKE好きな値を設定してください〜

于 2014-11-08T06:18:15.767 に答える