UIWebView or UIScrollView for HTML like View in iPhone Application - iphone

Sorry for this simple question but I am looking for the design pattern for adding a simple HTML like page to an iPhone app.
My intuition tells me that making a View with a full screen WebView inside is obviously the easiest option, but I think a UIScrollView is better.
What's the best practice?
I basically want to have some text, float some images, add a few links etc.
Should I use WebView or ScrollView?
Thank you,
Kent

Well you're going to need a UIWebView if you want to display the contents of a local or remote web page. You would want to use a UIScrollView if you wanted to draw all of the content programmatically.
I think you want a UIWebView.

Related

Customize UI with UIWebView vs Subclassing

I need to create a custom button, custom label, custom tableview, and custom datepicker, but it seems harder to subclass the button/label/table/datepicker than to create a HTML string inside a UIWebView and customize it there... My application would be full Objective-c except these 4 controls.
What does Apple say about customizing a control using UIWebview. Is it frowned upon?
What are pro & cons for these 2 approaches?
Should I take a quick HTML, but it feels like I'm cheating, or take a long process to subclass these controls? More importantly, will Apple approve my apps with controls that's using UIWebView?
Thanks.
I'm sure Apple would approve an app with HTML controls, but I'd strongly advise you do it right and subclass the controls you wish to customise (or create your own from scratch). In my experience, native controls are leaps and bounds above what you can achieve with HTML and CSS, and it'll be worth it in the long run.
Besides, UILabels, UIButtons, and UITableViews are actually quite easy to customise; you may have some difficulty with the UIDatePicker but it's still possible to make it your own.
Ok, just in case somebody is having the same problem as me, I finally found another easy way to "customize" the view without going into so much trouble subclassing it..
It's : Use an image to be used as the view background. Then you can place the controls in the placeholder in the image. And set the controls as transparent...

Best way to display web content on my iPhone app (if possible without using UIWebView)

I want to build an iPhone app that should , among other things, display the some content of a website's detail pages. This content includes a)a title b) an image c) a text passage (with multiple paragraphs.
I have done a brief research and found out that the easiest way to do this is by using uiwebview. The problem is that in that scenario I would have to be constantly in touch with the person responsible for the website in order to create a modified html/css version for the iPhone client.
As a result I was wondering if there is a feasible alternative. I can get the data I want in json format with HTML Requests. Maybe if I used a UIScrollView that contains a UILabel for the title, a UIImage for the image and another UILabel for the text passage? But the problem is how to set the UIscrollview content size since it dependent on the size of the text passage?
I am a iPhone dev noob and I am possibly missing something obvious here so I would be very greatful if someone could point me in the right direction.
Sounds like you are building an app ontop of somebody elses content. Provided this is legal, this other site should have a published api where you can start to write your app. Get the json or xml, then populate them in a UIViewController using a UIImageView to display the image, UITextView for the text. The UITextView already has a built in scroller so you dont need a UIScrollView

is it possible to add images in between the text view in iphone

I'm developing an application. It consists of notes and images also. I'm unable to find the best way of coding to add images and text together.
I want to add the images between the textview and after that, the text has to continue. Is it possible to do like this?
You will probably be better to use a webview and load in some static html from the application unless you particularly need textviews, in which case look at holding things in UITableView

how to load the pdf through programming with animation in iphone

how load a pdf into iphone and my pdf is of 200 pages then it should allow to turn the pages as we do with while reading book manually means use animation to turn a page one by one ..
Thanking you ..
Loading a large PDF and having page flipping animation isn't very simple. You can use a UIWebView like #Jim says to load the entire thing by just pointing the UIWebView's URL to the PDF but you won't get page animation. However to get full control requires that you render the PDF page by page manually to a view, and create the view's turning animation your self. Its nontrivial, and given your question you don't sound like you know enough to realistically achieve this right off.
Use UIWebView Control to load pdf files.

Is there a HTML wrapper in Cocoa other then UIWebView?

I have a bunch of texts and images (taken from the content tag of a RSS feed item) that I want to display in my app. I've managed to extract them from the entire content tag with some regular expressions. But the thing is, in order for the texts to appear before all the images are loaded, I need to preload all the images, and even more, I need to reposition all the texts/images when an image is loaded, because I don't know their size at first, to position the element under them correctly.
I realized this is too much hard-work for such a simple task.
I searched for some simple HTML wrapper but I found nothing. And than I realized: hey, I can insert HTML directly into an UIWebView. But then again, I see UIWebView more like an iFrame in HTML, and by that I mean not a very flexible/fluid element. The content will be bigger than the iPhone screen height, can the UIWebView adjust to fit it's contents? I don't want the browser zoom features and all, but rather to blend in the page.
So bottom line: In order to display a bunch of texts combined with images, should I continue with my initial pain-in-the-ass method, should I use a UIWebView, or is there another simple element like the one in my dreams? :)
Thanks.
Definitely use the web view; it has hundreds of person-years of work behind it, and is realistically impossible for you to reproduce by yourself. To keep it from zooming, you can add a viewport meta tag to your HTML fragment.
...[S]hould I continue with my initial pain-in-the-ass method, should I use a UIWebView, or is there another simple element like the one in my dreams...
I'm not entirely sure what you have against UIWebView, it's a decent and fairly complex element that can support many behaviors. One of the extremely attractive properties of IB and Cocoa development is that prototyping is very quick. I think you should spend half an hour and play around with the component. Writing your own code is definitely an option, but layout engines (ie WebKit in UIWebView/Safari, or Gecko in Firefox) is a complicated task. Why reinvent the wheel?
HTH.