开发者

How to add a navigation bar to a viewController presented using modalView in iPad

I am implementing a facebook integration in my ipad app.I am presenting a veiwController to load facebook URL modally using modalPresentationStyle = UIModalTransitionStyleCrossDissolve. Now I want to implement a navigation bar on the top which will show a title Facebook and a button to close this view.

I tried adding a navigation bar but it didn't show up because my viewController is not tied to any navigationController and tried toolbar as a subview to the viewController's view but it shows up only after the webView is finished loading.

I w开发者_开发问答ant to know how should I implement a permanent navigation bar so that I can any time close the modal view.


While the navigation bar doesn't show up automatically, you can always add the navigation bar via IB. I was able to get it working in a sample project. You can take a look and see if it helps you.

Another thing is that you are doing modalPresentationStyle = UIModalTransitionStyleCrossDissolve;. This is incorrect in that you are assigning a transition style to the presentation style property but works because the values are basically enums and UIModalTransitionStyleCrossDissolve ends up with the same value as UIModalPresentationFormSheet.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜