开发者

ModalViewController not being present to user

开发者 https://www.devze.com 2023-03-15 13:10 出处:网络
I am building a modal view with the following frame... _webView = [[UIWebView alloc] initWithFrame: CGRectMake(0, 0, 480, 320)];

I am building a modal view with the following frame...

_webView = [[UIWebView alloc] initWithFrame: CGRectMake(0, 0, 480, 320)];
[_authController addSubview:_webView];

[self presentModalViewController:_authController animated:YES];

Should the Modal View automatically be placed in front of any other view that is currently in the superview view stack?

This modal view works in an example app that i am going off of, but it will not show if I try to present it within my custom app.

EDIT:

NSLog([NSString stringWithFormat:@"frame = %f, %f, %f, %f", _webView.view.frame.origin.x, _webView.view.frame.origin.y, _webView.view.frame.size.width, _webView.view.frame.size.height]);

if (_webView)
{
    [self presentModalViewController:_webView animated:YES];
}

NSLog([NSString stringWithFormat:@"frame = %f, %f, %f, %f", _webView.view.frame.origin.x, _webView.view.frame.origin.y, _webView.view.frame.size.width, _web开发者_如何学PythonView.view.frame.size.height]);

this has this output...

frame = 0.000000, 0.000000, 320.000000, 416.000000 <-- Before presentModalViewController

frame = 480.000000, 0.000000, 480.000000, 320.000000 <-- After presentModalViewController


I believe the issue is that you are trying to use UIWebView (which inherits from UIView) as the modal view controller, which expects a UIViewController instance instead. Using a view controller with the webView as its view should let you display it.

0

精彩评论

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