iOS - 标签栏 UIWebView
对于 iOS 开发来说相当陌生——所以这可能比我想象的要容易。
情况: 创建新的选项卡栏应用程序时,它会创建 MainWindows.xib 和 FirstView.xib
问题: 我想在第一个选项卡中放入 UIWebView 并为其编写代码。我看过很多 Youtube 视频和教程,但他们似乎将 UIView 加载到 MainWindows.xib 中 - 也许是旧版本?
我所做的: 我已将 IBOutlet 命名为 - Home // IBOutlet UIWebView *Home; 我还在 .m 文件中告诉 UIWebview 加载后应该去哪里(google.com) 现在,在界面生成器中,如果我选择第一个选项卡栏,我可以在出口部分看到“主页”,我需要将其链接到我的 FirstView。
我该怎么办?当我在圆圈上计时或按住 Control 键单击时,它不想选择另一个 .xib 文件中的 UIWebView。
非常感谢任何帮助。
干杯杰夫
它似乎不起作用 - 该类位于不同的 xib 文件中,所以我无法将其拖过?
Pretty new to iOS development - so this may be easier than I think.
Situation:
When creating a new tab bar application, it creates a MainWindows.xib and a FirstView.xib
Problem:
I want to put in a UIWebView in the First Tab and have written the code for it. I have seen plenty of Youtube Vids and tutorials, but they seem to load the UIViews into the MainWindows.xib - maybe an older version??
What I have done:
I have named the IBOutlet - Home // IBOutlet UIWebView *Home;
I have also told in the .m file where the UIWebview should go to once loaded (google.com)
Now in interface builder if I select the first tab bar, I can see the "home" in my outlet section and I need to link that to my FirstView.
How do I do that??? when I clock on the circle, or control-click, it does not want to select the UIWebView in another .xib file.
Any help is greatly appreciated.
Cheers Jeff
It does not seem to work - the class is in a different xib file, so I cant drag it across??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在Interface Builder中打开FirstView.xib,从左侧窗格中的对象列表中选择视图,打开实用程序窗格(3个具有不同视图布局的图标,位于Xcode的右上角,上面写着“视图在下面,实用程序在右侧”)。切换到身份检查器选项卡并将类更改为 UIWebView。然后只需将新出口添加到 FirstViewController 并将 Web 视图连接到文件所有者 .view 出口。
Open FirstView.xib in Interface Builder, from left pane in Objects list select View, open Utilities pane (3 icons with different view layouts, located in upper right corner of Xcode, it says View underneath, Utilities is on right). Switch to Identity inspector tab and change class to UIWebView. Then just add new outlet to FirstViewController and connect web view to Files owner .view outlet.