0
몇 가지 사용자 지정 단추가 추가 된 간단한 viewcontroller가 있습니다.viewcontroller not rotating
-(void)viewWillLayoutSubviews {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
NSLog(@"Detected IPAD");
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation))
{
NSLog(@"Orientation is PORTAIT");
UIImage *serviceTask = [UIImage imageNamed:@"main_l_serviceorder.png"];
btnServiceOrder = [UIButton buttonWithType:UIButtonTypeCustom];
btnServiceOrder.frame = CGRectMake(143.0, 37.0, 226.0, 200.0);
[btnServiceOrder setBackgroundImage:serviceTask forState:UIControlStateNormal];
[btnServiceOrder addTarget:self action:@selector(gotoServiceOrders:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btnServiceOrder];
//similar codes goes here..
}
else
{
NSLog(@"Orientation is LANDSCAPE");
//similar codes goes here..
}
}
}
은 내가 감가 상각 iOS6의 shouldAutorotateToInterfaceOrientation 같이 다음과 같은 추가했습니다.,
을- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
NSLog(@"Rotated!.");
}
- (BOOL)shouldAutorotate {
return YES;
}
- (NSInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return (UIInterfaceOrientationMaskLandscape | UIInterfaceOrientationMaskPortrait);
}
의 ViewController가 Portait입니다 모드에서로드 만! .. pls는 저를 안내!