Question

The Problem

I have made a subclass of UIViewController that handles landscape mode, then I subclassed my subclass, that is shown to the user. Now, I wan't to add a subclass in the landscape view, and have the size the same as the landscape view, but in order to get the frame I need to add the action

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation

which I also used in my first subclass. However, when I do this, it ignores all the code in the superclass, and does that one thing (get the frame)

What I CAN do

  • I can get the landscape frame with a piece of code, like [[UIScreen mainScreen].landscapeFrame or something like that (if it exists)
  • Rewrite the code from the superclass in the subclass (but then, what's the point to have a superclass?)

Update / Fix

Silly me, I forgot to add [super didRotateFromInterfaceOrientation: fromInterfaceOrientation]; Credit goes to Sanjay Chaudhry for noticing that, thanks! :)

Was it helpful?

Solution

Call Super's method in the overwritten method:

[super didRotateFromInterfaceOrientation: fromInterfaceOrientation];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top