I’ve been wondering how all the web apps display web content, say on a UITableView. When we call UIWebView instance method loadRequest: it simply surfs away to the link provided with the NSURL object. But how do we further manage all the contents with TableViews, ImageViews and so on. What is the basic principle of web apps in iOS? Do I need to learn HTML and any other web related technology like AJAX,java script etc.?
Share
You don’t display the contents of a
UIWebViewin aUITableView(orUIImageView, etc.) The apps you’re likely referring to use one of two approaches:Download the data using
NSURLConnection, usually with REST and JSON. Then display it in aUITableView.Display HTML content in a
UIWebViewthat looks like aUITableViewFor more information on the first case see the URL Loading System Programming Guide. For more information on the second case, see Getting Started with iOS Web Apps.
Most things that could run in MobileSafari can also run in a
UIWebView. It is difficult, however, to get native, correct behavior for all your UI elements using aUIWebView. Button taps in particular do not work correctly in most web apps. Swipes also can behave non-optimally. But even so, many “apps” out there are actually just web pages in aUIWebView. (The Facebook app is a good example of this.)