There is a possibility that we have to show web content in our application. The UIWebView
class helps us to do exactly that. To do this, simply create a UIWebView
object, attach it to a window, and send a request to load web content. We can also use this class to move back and forth in the history of web pages and you can even set some web content properties programmatically.
Now let's create a UIWebView
class that displays www.rubymotion.com in our view.
Update about_controller.rb
with the following code:
def submit_button @visitButton = UIButton.buttonWithType(UIButtonTypeRoundedRect) @visitButton.frame = [[80,10],[180,37]] @visitButton.setTitle("Visit", forState:UIControlStateNormal) @visitButton.setTitle("You have clicked me", forState:UIControlStateHighlighted) @visitButton.addTarget(self, action:"load_some_view", forControlEvents:UIControlEventTouchDown) view.addSubview(@visitButton) end def load_some_view @my_web_view = UIWebView.alloc...