Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 标题字体不';不要在导航栏中更改_Ios_Uinavigationcontroller_Storyboard - Fatal编程技术网

Ios 标题字体不';不要在导航栏中更改

Ios 标题字体不';不要在导航栏中更改,ios,uinavigationcontroller,storyboard,Ios,Uinavigationcontroller,Storyboard,我有一个嵌入在导航控制器中的控制器,我想更改导航栏中标题的字体。我想使用故事板,因此它会在整个应用程序中发生变化(而不是为NavigationController创建一个文件并通过代码执行);不是每个控制器: 我可以更改字体大小和颜色,但在使用自定义字体时无法更改字体系列。在这种情况下,所有其他Xcode字体都可以使用。我在应用程序中的任何地方都使用自定义字体,但它仅在导航时不起作用 这个问题的原因是什么?我在Xcode 6.4中遇到了完全相同的问题。这可能是Xcode的一个bug 目前,您可以

我有一个嵌入在导航控制器中的控制器,我想更改导航栏中标题的字体。我想使用故事板,因此它会在整个应用程序中发生变化(而不是为NavigationController创建一个文件并通过代码执行);不是每个控制器:

我可以更改字体大小和颜色,但在使用自定义字体时无法更改字体系列。在这种情况下,所有其他Xcode字体都可以使用。我在应用程序中的任何地方都使用自定义字体,但它仅在导航时不起作用


这个问题的原因是什么?

我在Xcode 6.4中遇到了完全相同的问题。这可能是Xcode的一个bug

目前,您可以通过编程方式设置自定义字体。(确保您的项目中有字体ttf文件,并在项目设置->信息->应用程序提供的字体中添加属性

Swift:

self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "LeagueGothic-Regular", size: 16.0)!, 
                                                                 NSForegroundColorAttributeName: UIColor.whiteColor()]
[[UINavigationBar appearance] setTitleTextAttributes: 
    [NSDictionary dictionaryWithObjectsAndKeys: 
        [UIColor whiteColor], NSForegroundColorAttributeName, 
           [UIFont fontWithName:@"LeagueGothic-Regular" size:16.0], NSFontAttributeName,nil]];
目标-C:

self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "LeagueGothic-Regular", size: 16.0)!, 
                                                                 NSForegroundColorAttributeName: UIColor.whiteColor()]
[[UINavigationBar appearance] setTitleTextAttributes: 
    [NSDictionary dictionaryWithObjectsAndKeys: 
        [UIColor whiteColor], NSForegroundColorAttributeName, 
           [UIFont fontWithName:@"LeagueGothic-Regular" size:16.0], NSFontAttributeName,nil]];

我也有同样的问题,但它似乎只是出现在故事板上。如果你编译你的应用程序,它会很好地工作

哇,还需要用代码来完成。把你的屎拿直苹果。