设置 UIButton 文本 [英] Set UIButton text

查看:32
本文介绍了设置 UIButton 文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的文本标签:

@property (strong, nonatomic) IBOutlet UILabel *textEmail;


 _titleGet = [_dictionaryGeter objectForKey:@"Email"];
    _textEmail.text= _titleGet;

objectForKey:@"Email" from plist

objectForKey:@"Email" from plist

我想做按钮.如何使按钮标题等于 textEmail?

I want to make button. How to make that button title to be equal to the textEmail?

推荐答案

有两种方法可以设置 UIButton 的标题.

There are two ways to set the title of a UIButton.

选项 1(错误的方式):myButton.titleLabel.text = myString

Option 1 (the wrong way): myButton.titleLabel.text = myString

选项 2(正确的方法):[myButton setTitle:myString forState:UIControlStateNormal];

Option 2 (the right way): [myButton setTitle:myString forState:UIControlStateNormal];

因此,您的代码将是:

_titleGet = [_dictionaryGeter objectForKey:@"Email"];
[_btn setTitle:_titleGet forState:UIControlStateNormal];

这篇关于设置 UIButton 文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆