PDA

View Full Version : View not aligned to the window?




Aranince
Sep 15, 2009, 02:46 AM
I have two .xib files. I got it to transition from the first nib to the second just fine, however on the second nib, the view isn't aligned properly. I have no idea why it is doing this. Any ideas?

Here is where I show the view

- (void)showTextView {
TextViewController *aTextViewController = [[TextViewController alloc] initWithNibName:@"TextView" bundle: nil];
[self setTextViewController:aTextViewController];
[aTextViewController release];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:NO];
[viewController.view removeFromSuperview];
[self.window addSubview:[textViewController view]];
[UIView commitAnimations];

}



H2G2
Sep 15, 2009, 04:56 AM
Something like that may help :


CGRect frame = [[UIScreen mainScreen] applicationFrame];
[MyControllerView SetFrame:frame];


This will stick the view to the iPhone screen bounds.
Of course, you could also define another frame using the CGRect (http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGGeometry/Reference/reference.html#//apple_ref/doc/c_ref/CGRect) struct if you don't want the view to fill the whole screen


PS : since my Mac is out of order, I can't test, so there may be mistakes. But the general idea should be ok.

dejo
Sep 15, 2009, 10:37 AM
PS : since my Mac is out of order, I can't test, so there may be mistakes. But the general idea should be ok.
Yeah, looks like you would at least want:
[MyControllerView.view setFrame:frame];
instead.

Aranince
Sep 15, 2009, 07:58 PM
Thanks, fixed it!