- Home /
Question by
RCSlat88 · Nov 22, 2010 at 03:01 PM ·
unityiphoneuiview
UIView as subclass of Unity's UIWindow
After commenting out iphone::KeyboardOnScreen::Init();
in appController.mm to ensure that I am able to receive autorotation events, I am trying to add a UIView to the Unity's window in the appController:
-(void) applicationDidFinishLaunching:(UIApplication*)application{
printf_console("-> applicationDidFinishLaunching()\n");UIWindow *topWindow = [[UIApplication sharedApplication]keyWindow];
menuVC = [[MenuTestViewController alloc] initWithNibName:@"MenuTestViewController" bundle:nil];
menuVC.view.frame = CGRectMake(0,0,200,1024);
[topWindow addSubview:menuVC.view];
When I run it, my menuVC.view
fills the entire view, and through NSLogs I see that after
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
NSLog(@"MenuTestViewController.shouldAutorotateToInterfaceOrientation");
// Overriden to allow any orientation.
if((interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (interfaceOrientation == UIDeviceOrientationLandscapeRight)){
return YES;
}else{
return NO;
}
}
The bounds and frame of menuVC.view are reset to 1024x768. I gave up on it for awhile but after seeing rolls royce's Phantom iPad application execute it properly, I'm more determined than ever. Thoughts?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613084023im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can Unity 3 build for the iOS Simulator? 2 Answers
Multiplayer for iPhone. 1 Answer
Help Basketball Shooting Game 0 Answers
Help with simple canvas creation 2 Answers
Accessing the iOS Photo Picker? 1 Answer