119 lines
3.1 KiB
Objective-C
Executable File
119 lines
3.1 KiB
Objective-C
Executable File
//
|
|
// NavgationController.m
|
|
// TestNav
|
|
//
|
|
// Created by iTrends on 13-4-18.
|
|
// Copyright (c) 2013年 iTrends. All rights reserved.
|
|
//
|
|
|
|
#import "NavgationController.h"
|
|
#import "AppDelegate.h"
|
|
#import "threeView.h"
|
|
@interface NavgationController ()
|
|
|
|
@end
|
|
|
|
@implementation NavgationController
|
|
|
|
@synthesize navType=_navType;
|
|
|
|
-(id)initWithRootViewController:(UIViewController *)rootViewController Navtype:(NavgationType)navType
|
|
{
|
|
if(self){
|
|
self.navType=navType;
|
|
self=[super initWithRootViewController:rootViewController];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
|
|
|
|
//- (NSUInteger)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0){
|
|
// // if ([[FuncPublic GetDefaultInfo:@"stateOrie"] isEqualToString:@"yes"]) {
|
|
// switch (self.navType) {
|
|
// case NavgationTypeMaskPortrait:
|
|
// return UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown;
|
|
// break;
|
|
// case NavgationTypeMaskLandscape:
|
|
// return UIInterfaceOrientationMaskLandscape;
|
|
// break;
|
|
// case NavgationTypeMaskAll:
|
|
// return UIInterfaceOrientationMaskAll;
|
|
// break;
|
|
// default:
|
|
// break;
|
|
// }
|
|
// }else
|
|
// {
|
|
// AppDelegate *delegate=[UIApplication sharedApplication].delegate;
|
|
// return delegate.oriention;
|
|
// }
|
|
//}
|
|
//- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
|
|
//
|
|
// //return UIInterfaceOrientationLandscapeLeft;
|
|
// switch (self.navType) {
|
|
// case NavgationTypeMaskPortrait:
|
|
// return UIInterfaceOrientationPortrait;
|
|
// break;
|
|
// case NavgationTypeMaskLandscape:
|
|
// return UIInterfaceOrientationLandscapeLeft;
|
|
// break;
|
|
// case NavgationTypeMaskAll:
|
|
// return UIInterfaceOrientationLandscapeLeft|UIInterfaceOrientationPortrait;
|
|
// break;
|
|
// default:
|
|
// break;
|
|
// }
|
|
//
|
|
//}
|
|
//支持的方向 因为界面A我们只需要支持竖屏
|
|
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
|
|
|
return [self.viewControllers.firstObject supportedInterfaceOrientations];
|
|
}
|
|
-(BOOL)shouldAutorotate{
|
|
|
|
if ([FuncPublic SharedFuncPublic]._CurrentShow==3) {
|
|
return NO;
|
|
}
|
|
return self.viewControllers.firstObject.shouldAutorotate;
|
|
|
|
}
|
|
|
|
|
|
//当前viewcontroller默认的屏幕方向 - 横屏显示
|
|
|
|
//-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
|
|
//
|
|
// return UIInterfaceOrientationLandscapeRight;
|
|
//
|
|
//}
|
|
|
|
/*
|
|
若ios得版本号小于6.0
|
|
在nav->rootviewcontroller中加入如下代码
|
|
self替换为xxx.navigationcontroller
|
|
|
|
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation NS_DEPRECATED_IOS(2_0, 6_0){
|
|
|
|
switch (self.navType) {
|
|
case NavgationTypeMaskPortrait:
|
|
return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);
|
|
break;
|
|
case NavgationTypeMaskLandscape:
|
|
return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);
|
|
break;
|
|
case NavgationTypeMaskAll:
|
|
return YES;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
|
|
}*/
|
|
|
|
|
|
@end
|