Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom UIWindow orientation

I needed to see touch events on my window, so I subclassed UIWindow to make my a MYWindow class. I am overriding the sentEvent function to receive the touch events on the window and all of that is working just fine. I did the following to achieve this:

self.window = [[MYWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window makeKeyAndVisible];

The issue I am facing is that when I do this, the viewControllers that are on this window won't rotate anymore. If I were to use a regular UIWindow, they all work just like I intended them to work. Obviously, something is wrong with my setup.

I was looking through UIWindow header file and there is a method called

- (void)becomeKeyWindow;  //override point for subclass, Do Not call directly

Am I suppose to implement this in my custom UIWindow class just like I had to implement the sendEvent: method? Please point me in the right direction with this.

Thanks in advance guys.

like image 696
Bittu Avatar asked Jul 17 '26 18:07

Bittu


1 Answers

I figured out what the issue was. I was creating a delegate on the custom window and called it "delegate" which was causing the issue. Naming it to "aDelegate" solved the issue. thanks for all your help.

like image 115
Bittu Avatar answered Jul 19 '26 08:07

Bittu