ios 7中拆分视图中的奇怪行为

时间:2013-10-10 11:11:14

标签: iphone ios objective-c uisplitviewcontroller

我在我的应用中实施了SplitView,如下所示。

AppDelegate.h

@property (nonatomic, strong) IBOutlet UISplitViewController *splitViewController;

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
     LeftsideViewController *masterViewController = [[LeftsideViewController alloc] initWithNibName:@"LeftsideViewController" bundle:nil] ;
    UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController] ;

    HomeViewController *detailViewController = [[HomeViewController alloc] initWithNibName:@"HomeViewController_iPad" bundle:nil];
    UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
    masterViewController.homeViewController = detailViewController;

    self.splitViewController = [[UISplitViewController alloc] init] ;
    [self.splitViewController.view setBackgroundColor:[UIColor blackColor]];
    self.splitViewController.delegate = detailViewController;
    self.splitViewController.viewControllers=[NSArray arrayWithObjects:masterNavigationController,detailNavigationController,nil];

    self.window.rootViewController = self.splitViewController;
     NSLog(@"VIEWs %@",[self.window subviews]);
    [self.window makeKeyAndVisible];

    return YES;
}

问题

在ios 6中工作正常。

但是在ios 7中它显示了我没有包含的一些视图。 请参阅我的以下图片& extra view is in Pink Colorenter image description here

1 个答案:

答案 0 :(得分:0)

float systemversion=[[[UIDevice currentDevice]systemVersion]floatValue];

    if(systemversion>=7.0f)
    {

        self.edgesForExtendedLayout=UIRectEdgeNone;
    }

试试此代码