// ボタンを追加
UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoLight];
button.frame = CGRectMake(100,100,100,100);
[button addTarget:self action:@selector(doAction:)
forControlEvents:UIControlEventTouchUpInside];
// 追加したいviewにaddSubview
[self.view addSubview:button];
逆にUIView内にあるsubviewを削除する場合
for (UIView *view in [self.view subviews]) {
[view removeFromSuperview];
}
0 件のコメント:
コメントを投稿