iOS勉強中です。私は Xcode 4.3.2 を使用しています。ボタンを作成し、コールバックで次のコードを使用しました。
1) シングル ビュー アプリケーションを作成 2) 新しいビューを作成 -> newV 3) ボタンを作成 4) newV のサブビューとして追加します。5) newV をメイン ビューのサブビューとして追加します。
-(IBAction) submitButtonPressed:(id)sender
{
NSLog (@" Submit Button is pressed ");
UIView *newV = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
newV.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
UIButton *but = [[UIButton alloc] init];
[but setTitle:@"SubView" forState:UIControlStateNormal];
[newV addSubview:but];
[self.view addSubview:newV];
}
しかし、私が得る問題は、ビューviewVのみが表示され、ボタンが表示されないことです。この問題を解決するには?