IOSでUIButtonの生成サンプル
-(void)viewDidLoad{
[super viewDidLoad];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
// -(void)viewDidLoad{
[super viewDidLoad];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
// 関連イベント
[button addTarget:self action:@selector(theButtonClick) trolEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];
}
-(void)theButtonClick{
// ボタンをクリックした後動作
}
[button addTarget:self action:@selector(theButtonClick) trolEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];
}
-(void)theButtonClick{
// ボタンをクリックした後動作
}