현재 일부 그림이있는 scrollview 있습니다. 휴대 전화를 가로 방향으로 회전 시키면 전체 화면이 이미지로 덮 이도록 scrollview의 그림이 커지도록 (전체 화면) 원합니다. 다시 세로로 회전 시키면 전체 화면 이미지가 제거됩니다.회전 전체 화면에 UIImageView 표시
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOrientationChange) name:UIDeviceOrientationDidChangeNotification object:nil];
하고 처리하기 : I 회전 변화 감지 내 viewDidLoad에 지금까지 무슨 짓을
- (void)handleOrientationChange
{
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) ||
([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) {
UIImageView *fullScreenImage = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[fullScreenImage setImage:[UIImage imageNamed:[[PflanzenSingletonClass sharedManager] loadStringFromUserDefaultsForKey:CurrentScrollViewImage]]];
[fullScreenImage setTag:999];
[self.view addSubview:fullScreenImage];
} else
{
[[[self.view subviews] objectAtIndex:([[self.view subviews] count] - 1)] removeFromSuperview];
}
}
을하지만 (분명 내 잘못을) 예상대로 작동하지 않습니다.
- ImageView는 실제로 전체 화면이 아닙니다. 내비게이션 막대가 계속 표시됩니다.
- 이미지가 가로 방향으로 회전하지 않습니다. 방향 변경이 발생하기 직전에 제 방법이 호출됩니까?
- 2. 때문에 이미지가 늘어납니다.
- 애니메이션을 사용하여 훨씬 더 매끄럽게 만들고 싶습니다. 시작점은 scrollview의 rect입니다.
아이디어가 있으십니까? 고마워. 당신의 ViewController에서이 문제를 해결할 경우
을 :(I은 여전히 내비게이션 막대를 참조하십시오 – DanielR
UIImageView 여전히 내 UITableView 위에 있지만 NavigationControllerView 뒤에있는 것 같아 – DanielR
당신은 확실히 keyWindow에 imageView를 추가 했습니까? 그렇다면 [keyWindow bringSubviewToFront : imageView];를 호출 해보십시오 – Mikhail