当我运行这个程序时,我没有得到想要的结果。我正在尝试构建的是一个属性程序,它在 UITextField 中从用户那里获取文本,当他们单击更新按钮时,它会在文本字段上方的 UILabel 中显示文本。一旦我开始工作,我将添加按钮来编辑文本。
#import "TextChangerViewController.h"
@interface TextChangerViewController ()
@property (strong, nonatomic) IBOutlet UITextField *textInput;
@property (strong, nonatomic) IBOutlet UILabel *textOutput;
@property (strong, nonatomic) IBOutlet UIButton *updateButton;
@end
@implementation TextChangerViewController
- (void)updateText:(NSAttributedString *)input
{
[self.textOutput setAttributedText:input];
}
- (IBAction)updateDisplayText:(UIButton *)sender
{
[self updateText:[[NSAttributedString alloc]initWithString:self.textInput.text]];
}
@end