背景色が赤の UIViewController クラスを作成しました。また、サブビューである UIView を作成し、背景画像と 2 つの UIButtons を配置しました。画面の向きのために私が与えるコーディングは
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
self.view =[[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
self.view.backgroundcolor =[UIColor redColor];
UIView *subview;
subview = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
subview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@""]];
subview.autoresizingMask = UIViewAutoResizingFlexibleWidth |UIViewAutoresizingFlexibleHeight;
問題:
横向きにすると、サブビューのサイズが画像に合わせて変更されますが、ボタンは同じ位置にあり、.xib ファイルを使用していません。プログラムでプロジェクトを作成しました。返信してください....