I have a Navigation controller that takes a user to another view and lays out the new view based on which button the user clicked on and the orientation. I have a method called layout
and I call this method in viewDidLoad
, viewWillAppear
, and willAnimateRotationToInterfaceOrientation
However, when the view is first loaded, the app does not recognise it's in Landscape. The code I have is:
UILabel *shareLabel = [[UILabel alloc] initWithFrame:CGRectMake(488, 90, 179, 30)];
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
shareLabel.frame = CGRectMake(543, 90, 238, 30);
}
I've even tried putting a break point on the if statement, and when it gets to the if statement, it steps over it, which tells me it's not recognising that it is landscape? Any ideas on why this would be?