私はiOSが初めてです。ここで UITextfield Sematic Issues とそのバリエーションを検索しました。私は非常にシンプルなアプリを作ろうとしています:
テキストフィールドにテキストを入力 Aボタンを押す テキストフィールドに入力されたテキストにラベルを変更します。
しかし、この奇妙なセマティック エラーが発生し続けており、修正方法がわかりません。
コードはここにあります:
.m ファイル。
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *myTextField;
@property (weak, nonatomic) IBOutlet UILabel *myLabel;
- (IBAction)changeLabel:(id)sender;
@end
.h
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)changeLabel:(id)sender {
NSString *message = [[NSString alloc] initWithFormat:@"Hello %@", [myTextField text]];
[myLabel setText:message];
}
ありがとう。