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

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

    1. <tfoot id='WD34f'></tfoot>
      <legend id='WD34f'><style id='WD34f'><dir id='WD34f'><q id='WD34f'></q></dir></style></legend>

      UIButton 标题消失

      UIButton title disappears(UIButton 标题消失)
      <i id='Qj8i5'><tr id='Qj8i5'><dt id='Qj8i5'><q id='Qj8i5'><span id='Qj8i5'><b id='Qj8i5'><form id='Qj8i5'><ins id='Qj8i5'></ins><ul id='Qj8i5'></ul><sub id='Qj8i5'></sub></form><legend id='Qj8i5'></legend><bdo id='Qj8i5'><pre id='Qj8i5'><center id='Qj8i5'></center></pre></bdo></b><th id='Qj8i5'></th></span></q></dt></tr></i><div id='Qj8i5'><tfoot id='Qj8i5'></tfoot><dl id='Qj8i5'><fieldset id='Qj8i5'></fieldset></dl></div>

        <tfoot id='Qj8i5'></tfoot>

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

      • <legend id='Qj8i5'><style id='Qj8i5'><dir id='Qj8i5'><q id='Qj8i5'></q></dir></style></legend>
          <tbody id='Qj8i5'></tbody>
          <bdo id='Qj8i5'></bdo><ul id='Qj8i5'></ul>

                本文介绍了UIButton 标题消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 ViewController,里面有一个 UIButton.当我点击时,按钮上的文字消失了.我为所有状态添加了所有 setTitle,但它继续消失.有什么想法吗?

                I have a ViewController with an UIButton inside. When I clicked, the text on the button disappeared. I add all the setTitle for all states, but it continues disappearing. Any idea?

                这是我的代码的一部分:

                This is a part of my code:

                @interface AddCardViewController : UITableViewController <UITextFieldDelegate>{
                UIButton *commit;
                    ......
                
                @implementation AddCardViewController
                
                - (void)viewDidLoad{
                
                    self.commit = [UIButton buttonWithType: UIButtonTypeCustom];
                
                    [self setCommitProperties];
                
                    [self.view addSubview:commit];
                
                 .........}
                
                
                
                - (void) setCommitProperties{
                
                   CGRect frameTable = self.tableView.frame;
                
                   CGRect frame = CGRectMake(frameTable.origin.x + 10, 140, frameTable.size.width - 20, 40);
                
                   commit.frame = frame;
                
                   [commit setBackgroundColor : [UIColor whiteColor]];
                
                   [commit setTitle: NSLocalizedString(@"AddCard",@"") forState: UIControlStateNormal];
                   [commit setTitle: NSLocalizedString(@"AddCard",@"") forState: UIControlStateSelected];
                   [commit setTitle: NSLocalizedString(@"AddCard",@"") forState: UIControlStateHighlighted];
                   [commit setTitle: NSLocalizedString(@"AddCard",@"") forState: UIControlStateApplication];
                   [commit setTitle: NSLocalizedString(@"AddCard",@"") forState: UIControlStateReserved];
                   [commit setTitle: NSLocalizedString(@"AddCard",@"") forState: UIControlStateDisabled];
                
                    [commit addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchDown];    
                
                   UIColor *color = [[[PersonalizationManager alloc] init] getColor: @"AddCardViewController" :@"Commit_Title"]; 
                
                   [commit.titleLabel setTextColor: color];
                
                   color = [[[PersonalizationManager alloc] init] getColor: @"AddCardViewController" :@"Commit_Border"];
                
                   [commit.layer setBorderColor:[color CGColor]];    
                   [commit.layer setBorderWidth : 0.5f];
                   [commit.layer setCornerRadius : 10.0f];
                }
                

                推荐答案

                嗯,这很难确定,但是文字是不是因为颜色相同而看不到?我看到您为所有状态设置了文本,但您可能还想为所有状态设置颜色.

                Well it's hard to say for sure, but is the text not visible because the color is the same? I see you set the text for all states but you may want to set the color for all states as well.

                [commit setTextColor:[UIColor redColor] forState:UIControlStateSelected];
                

                这篇关于UIButton 标题消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                UIButton title text color(UIButton 标题文本颜色)
                Stretch background image for UIButton(为 UIButton 拉伸背景图像)
                Using Tint color on UIImageView(在 UIImageView 上使用 Tint 颜色)
                How can I change UIButton title color?(如何更改 UIButton 标题颜色?)
                Minimum sensible button size on iPhone(iPhone 上的最小合理按钮大小)
                iPhone UIButton - image position(iPhone UIButton - 图像位置)
                        <bdo id='s2IEa'></bdo><ul id='s2IEa'></ul>

                      • <tfoot id='s2IEa'></tfoot>

                        1. <small id='s2IEa'></small><noframes id='s2IEa'>

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