Как узнать, какой вид просматривается в данный момент - PullRequest
1 голос
/ 10 ноября 2011

Я работаю над проектом, в котором я представляю таблицу значений, и когда пользователь поворачивает экран, пейзаж отображает детали в виде графика.

пока все это работает, но естьпроблема.Например, когда я иду от пролива LandscapeLeft к landscapeRight, он снова перемещает изображение.Очевидно, я не хочу, чтобы это произошло.

Вот код, который я использовал:

    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

if (orientation == UIDeviceOrientationLandscapeLeft)
{
    NSLog(@"Landscape Left!");
    GraphViewController *gvc = [[GraphViewController alloc] initWithNibName:@"GraphViewController" bundle:nil];

        [self.navigationController pushViewController:gvc animated:YES];
        strg.orient = [[NSNumber alloc] initWithInt:1];
}
if (orientation == UIDeviceOrientationLandscapeRight)
{
    NSLog(@"Landscape Right!");
    GraphViewController *gvc = [[GraphViewController alloc] initWithNibName:@"GraphViewController" bundle:nil];

        [self.navigationController pushViewController:gvc animated:YES];
        strg.orient = [[NSNumber alloc] initWithInt:2];
}
if (orientation == UIDeviceOrientationPortrait)
{
    NSLog(@"Portrate!");

    [self.navigationController popViewControllerAnimated:YES];
}   

Мой вопрос заключается в том, как я могу узнать, просмотрено ли уже представление, так что я могу сказать,NavigationController, чтобы не толкать его?

Спасибо всем!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...