ipad 응용 프로그램에서 viewcontroller의 배경으로 이미지를 배치하려고합니다. 나는 설정이보기 컨트롤러의 이미지를 배경 이미지로 설정하고 ipad에서 회전 할 때 유지 관리
UIImage *background = [UIImage imageNamed: @"[email protected]~ipad.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage: background];
imageView.frame = self.view.bounds;
[self.view addSubview: imageView];
[self.view sendSubviewToBack:imageView];
이 세로 모드에 대해 잘 작동하지만 내가 가로 모드로 회전 할 때 그림이 채워지지 않는 빈 공간이있어 사용. 다른 유사한 게시물을 기반으로 내 생각은 회전 GET의가 변경 될 때 호출되는 새 사진을 가지고 있었고, 난 똑같은 결과이
{ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight)){
UIImage *background = [UIImage imageNamed: @"[email protected]~ipad.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage: background];
imageView.frame = self.view.bounds;
[self.view addSubview: imageView];
[self.view sendSubviewToBack:imageView];
} else if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown)){
UIImage *background = [UIImage imageNamed: @"[email protected]~ipad.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage: background];
imageView.frame = self.view.bounds;
[self.view addSubview: imageView];
[self.view sendSubviewToBack:imageView];
}}
을 시도했다. 이 문제를 해결하는 방법에 대한 아이디어는 인정 될 것입니다!
가로에서 세로 또는 가로에서 세로로 장치를 회전 할 때 장치 가로를 세로 또는 세로로 회전하면 – dheeru
입니까? 경우 ((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight)) {} 다른 경우 ((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown)) {} – dheeru
앱에서 자동 레이아웃을 사용합니까? – rptwsthi