Monday, September 24, 2012

Develop a simple mobile web app

The simplest way to develop a mobile web app is to show a UIWebView in the iOS screen. The app itself will remain it's process in the web server. In short, you can't avoid developing the application functionality. Instead, you may roll out the implementation faster.

By using this design, you may hardcode the web server URL into the mobile web app so that your user does not have to remember what is your URL. The other advantage is that it is able to handle the Push Notification from the server.

The following article provides all the necessary sample codes on how to implement it.

http://developer.apple.com/library/ios/#DOCUMENTATION/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/DisplayWebContent/DisplayWebContent.html

Things that you may try out
  • Drag a text field, a button and a WebView to the iOS screen.
  • The UIWebView is referencing by "browser_ctl".
  • The button is referencing by "go_btn".
  • The text field is referencing by "url_txt".
  • Finally, link the button click event to the following method:
- (IBAction)ongo_click:(id)sender {
    NSString *fullURL = self.url_txt.text;
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [self.browser_ctl loadRequest:requestObj];
}

No comments:

Post a Comment