开发者

Problem with position of new view using presentModalViewController

I am trying to add a new view to my app using presentModalViewController.

ASpotImageViewController *aSpotImage = [[ASpotImageViewController alloc] initWithNibName:@"ASpotImageView" bundle:nil spotID:spotid];
aSpotImage.modalTransitionStyle = UIModalTra开发者_运维知识库nsitionStyleCrossDissolve;
//NSLog(@"frame is %@", aSpotImage.view.frame);
//NSLog(@"origin is %@", aSpotImage.view.frame.origin);
NSLog(@"description is %@", aSpotImage.description);
[aSpotImage setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentModalViewController:aSpotImage animated:YES];

But when I use this, the new view appears about 40 pixels or so down the screen, and the bottom is cut off. What could be causing this? I don't have this problem in other cases where I use this code.


Your current container is having frame of (320,440,0,40) hence when you present on it it appears to be offset'ed by that much amount, although in reality its just adding it to the location (0,0) with respect to the parent container. The fix would be to readjust the frame accordingly of your current view or the parent view.


Gurooj, are you implementing try this

UINavigationController *nextController = [[UINavigationController alloc] initWithRootViewController:aSpotImage];
[self presentModalViewController: nextController animated: YES];

the white space is usually the height of navigation bar, I guess?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜