후 리사이즈 난의 ViewController에서보기를 포함 AppDelegate에 함께 IPAD위한 간단한 구조를 갖는다 :UIViewAutoresizingNone : 회전
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
ClockVC *clockVC = [[ClockVC alloc]init];
clockVC.view.frame = CGRectMake(100, 100, clockVC.view.bounds.size.width, clockVC.view.bounds.size.height);
[self.window addSubview:clockVC.view];
[self.window makeKeyAndVisible];
return YES;
}
clockVC이 코드에 의해 정의되는있는 viewDidLoad 가지고
- (void)viewDidLoad {
[super viewDidLoad];
self.view.autoresizingMask = UIViewAutoresizingNone;
self.view.autoresizesSubviews = UIViewAutoresizingNone;
}
경계 clockVC는 IB에 의해 정의되고 적용에서 무시됩니다. didFinishLaunching ... 너비와 높이가 각각 200과 150입니다.
Cl 페이지가 올바르게 볼 제 부하 /
/ Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[UIView animateWithDuration:0.5
animations:^{self.view.alpha = 0;}
];
}
-(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
[UIView animateWithDuration:1
animations:^{self.view.alpha = 1;}
];
}
및 clockVC 뷰 위치이다 ockVC 한 단계 자동 회전 방법을 구현한다. clockVC 뷰 (autoResizeMask가 UIViewAutoresizingNon으로 설정 됨)를 회전 할 때 전체 화면을 차지하도록 크기를 조정하십시오.
왜 ?? 초기 크기를 원합니다.
내 문제의 스크린 샷입니다. 회전하기 전에 :
회전 후 :
방금 append delegate에'clockVC.view.autoresizingMask = UIViewAutoresizingNone;'을 추가했는데 아무것도 변경되지 않았습니다. – MatterGoal