Reputation: 12376
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.?
Upvotes: 2
Views: 432
Reputation: 299455
You don't display the contents of a UIWebView
in a UITableView
(or UIImageView
, 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 a UITableView
.
Display HTML content in a UIWebView
that looks like a UITableView
For 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 a UIWebView
. 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 a UIWebView
. (The Facebook app is a good example of this.)
Upvotes: 5