Search Results

Search found 1 results on 1 pages for 'freeappl3'.

Page 1/1 | 1 

  • Changing UIViews during UIInterfaceOrientation on iPad

    - by FreeAppl3
    I am trying to change views on rotation because my views have to be significantly different from portrait to landscape. Now the code I am using works once then the app freezes when trying to rotate back. Either direction does not make a difference. For example: If I am in Landscape and rotate to portrait everything works great until I rotate back to landscape then it freezes and does absolutely nothing. Here is the code I am using to achieve this In my "viewDidLoad" method [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil]; Then I call this for the rotation: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return YES; } - (void)didRotate:(NSNotification *)notification { UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; if ((orientation == UIDeviceOrientationLandscapeLeft) || (orientation == UIDeviceOrientationLandscapeLeft)) { // present the other viewController, it's only viewable in landscape [self.view addSubview:landScapeView]; } if ((orientation == UIDeviceOrientationLandscapeRight) || (orientation == UIDeviceOrientationLandscapeRight)) { // present the other viewController, it's only viewable in landscape [self.view addSubview:landScapeView]; } else if ((orientation == UIDeviceOrientationPortrait || (orientation == UIDeviceOrientationPortrait)) { // get rid of the landscape controller [self.view addSubview:portrait]; } else if ((orientation == UIDeviceOrientationPortraitUpsideDown || (orientation == UIDeviceOrientationPortraitUpsideDown)) { // get rid of the landscape controller [self.view addSubview:portrait]; } }

    Read the article

1