0
UIButton
を作成しますが、画面に表示されません。 .MファイルになぜUIButtonが画面に表示されないのですか?
@property (weak, nonatomic) IBOutlet UIButton * button;
@property (weak, nonatomic) IBOutlet UIImage * Image1;
::.hファイルで
_button = [UIButton buttonWithType:UIButtonTypeCustom];
[_button addTarget:self action:@selector(_button1:) forControlEvents:UIControlEventTouchUpInside];
[_button setTitle:@"Show View" forState:UIControlStateNormal];
_button.frame = CGRectMake(0, 0, 437, 765);
_Image1 = [UIImage imageNamed:@"1.png"];
[_button setBackgroundImage:_Image1 forState:UIControlStateNormal];
[self.view addSubview: _button];
このボタンは動作しないのはなぜ?
しかし、このボタンが機能します。
UIButton *button1;
button1 = [UIButton buttonWithType:UIButtonTypeCustom];
[button1 addTarget:self action:@selector(swipeleft1:) forControlEvents:UIControlEventTouchUpInside];
[button1 setTitle:@"Show View" forState:UIControlStateNormal];
button1.frame = CGRectMake(0, 0, 437, 765);
UIImage *buttonImage1 = [UIImage imageNamed:@"1.png"];
[button1 setBackgroundImage:buttonImage1 forState:UIControlStateNormal];
[self.view addSubview:button1];
「does not work」とはどういう意味ですか? – Proton
ボタンが画面に表示されない – user214155
'_button'、プロパティ、またはivarをどのように定義しますか? – Proton