• <legend id='PQ7ET'><style id='PQ7ET'><dir id='PQ7ET'><q id='PQ7ET'></q></dir></style></legend>

        <bdo id='PQ7ET'></bdo><ul id='PQ7ET'></ul>
    1. <tfoot id='PQ7ET'></tfoot>
      <i id='PQ7ET'><tr id='PQ7ET'><dt id='PQ7ET'><q id='PQ7ET'><span id='PQ7ET'><b id='PQ7ET'><form id='PQ7ET'><ins id='PQ7ET'></ins><ul id='PQ7ET'></ul><sub id='PQ7ET'></sub></form><legend id='PQ7ET'></legend><bdo id='PQ7ET'><pre id='PQ7ET'><center id='PQ7ET'></center></pre></bdo></b><th id='PQ7ET'></th></span></q></dt></tr></i><div id='PQ7ET'><tfoot id='PQ7ET'></tfoot><dl id='PQ7ET'><fieldset id='PQ7ET'></fieldset></dl></div>
    2. <small id='PQ7ET'></small><noframes id='PQ7ET'>

        如何动态调整导航栏中标题的大小

        How to resize Title in a navigation bar dynamically(如何动态调整导航栏中标题的大小)
          <tbody id='v1qiE'></tbody>

          <tfoot id='v1qiE'></tfoot>

            <small id='v1qiE'></small><noframes id='v1qiE'>

            <legend id='v1qiE'><style id='v1qiE'><dir id='v1qiE'><q id='v1qiE'></q></dir></style></legend>
              <bdo id='v1qiE'></bdo><ul id='v1qiE'></ul>
              <i id='v1qiE'><tr id='v1qiE'><dt id='v1qiE'><q id='v1qiE'><span id='v1qiE'><b id='v1qiE'><form id='v1qiE'><ins id='v1qiE'></ins><ul id='v1qiE'></ul><sub id='v1qiE'></sub></form><legend id='v1qiE'></legend><bdo id='v1qiE'><pre id='v1qiE'><center id='v1qiE'></center></pre></bdo></b><th id='v1qiE'></th></span></q></dt></tr></i><div id='v1qiE'><tfoot id='v1qiE'></tfoot><dl id='v1qiE'><fieldset id='v1qiE'></fieldset></dl></div>

                1. 本文介绍了如何动态调整导航栏中标题的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一些视图显示在导航控制器中.其中两个视图的导航栏标题较长.

                  I have some views that show up in a navigation controller. Two of these views have a longer title for the navigation bar.

                  问题是当标题太长放不下时,会截断部分字符并添加...".

                  The problem is that when the title is too long to fit, some characters are truncated and "..." is added.

                  有什么方法可以告诉导航栏自动调整标题文本的大小以适应?

                  Is there any way I can tell the Navigation bar to re-size the title text automatically to fit?

                  推荐答案

                  在 ViewDidload 中使用了以下代码.

                  Used the below code in ViewDidload .

                  目标 C

                  self.title = @"Your TiTle Text";
                  UILabel* tlabel=[[UILabel alloc] initWithFrame:CGRectMake(0,0, 200, 40)];
                  tlabel.text=self.navigationItem.title;
                  tlabel.textColor=[UIColor whiteColor];
                  tlabel.font = [UIFont fontWithName:@"Helvetica-Bold" size: 30.0];
                  tlabel.backgroundColor =[UIColor clearColor];
                  tlabel.adjustsFontSizeToFitWidth=YES;
                  tlabel.textAlignment = NSTextAlignmentCenter;
                  self.navigationItem.titleView=tlabel;
                  

                  斯威夫特版

                  self.title = "Your Title Text"
                  let tlabel = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 40))
                  tlabel.text = self.title
                  tlabel.textColor = UIColor.white
                  tlabel.font = UIFont.systemFont(ofSize: 30, weight: .bold)
                  tlabel.backgroundColor = UIColor.clear
                  tlabel.adjustsFontSizeToFitWidth = true
                  tlabel.textAlignment = .center
                  self.navigationItem.titleView = tlabel
                  

                  希望它对你有用.谢谢

                  这篇关于如何动态调整导航栏中标题的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UIImageView Gestures (Zoom, Rotate) Question(UIImageView 手势(缩放、旋转)问题)
                  Responsive website on iPhone - unwanted white space on rotate from landscape to portrait(iPhone上的响应式网站-从横向旋转到纵向时不需要的空白)
                  How to rotate an image 90 degrees on iOS?(如何在 iOS 上将图像旋转 90 度?)
                  How to capture current view screenshot and reuse in code? (iPhone SDK)(如何捕获当前视图屏幕截图并在代码中重用?(iPhone SDK))
                  iOS 6 shouldAutorotate: is NOT being called(iOS 6 shouldAutorotate: 没有被调用)
                  What is the PastryKit Framework?(PastryKit 框架是什么?)

                    • <tfoot id='6Xrtz'></tfoot>
                      <i id='6Xrtz'><tr id='6Xrtz'><dt id='6Xrtz'><q id='6Xrtz'><span id='6Xrtz'><b id='6Xrtz'><form id='6Xrtz'><ins id='6Xrtz'></ins><ul id='6Xrtz'></ul><sub id='6Xrtz'></sub></form><legend id='6Xrtz'></legend><bdo id='6Xrtz'><pre id='6Xrtz'><center id='6Xrtz'></center></pre></bdo></b><th id='6Xrtz'></th></span></q></dt></tr></i><div id='6Xrtz'><tfoot id='6Xrtz'></tfoot><dl id='6Xrtz'><fieldset id='6Xrtz'></fieldset></dl></div>
                        <tbody id='6Xrtz'></tbody>

                          <legend id='6Xrtz'><style id='6Xrtz'><dir id='6Xrtz'><q id='6Xrtz'></q></dir></style></legend>

                          • <bdo id='6Xrtz'></bdo><ul id='6Xrtz'></ul>

                            <small id='6Xrtz'></small><noframes id='6Xrtz'>