views:

826

answers:

3

I'm building a navigation controller based iPhone application and am curious how to go about building the detail view for my application. The part that's complicating my endeavor is: What UI elements/hierarchy should I employ to create a variable-height yet scrollable detail view?

A great example of my goal is an arrangement like the mobile App Store detail view. The horizontal divisions between the heading, description, screenshot, etc leads me to believe it's a table view in disguise, but that's just a guess.

Currently, I'm using a UIScrollView for my detail view, but since I can never be sure of the exact length of my incoming content, my description view ends up with either unused space or truncated text. Is there some set of elements that would be best suited for displaying this variable-height content in "blocky" format (like the example) while still maintaining overall view scroll-ability?

Thanks in advance for your assistance!

+1  A: 

I don't think the App Store detail view is a UITableView. In fact, I'm pretty sure it's a subclass of UIScrollView.

To determine the size of your content, you can use NSString's sizeWithFont method.

Can Berk Güder
+1  A: 

If you want to be able to easily format complex content you can use a UIWebView. What I basically do is create an HTML template and add it as a resource. At run time I load the content of this HTML doc and do string replacement to add the content I want. Within the HTML I place placeholders like

<div><!-- ARTICLE_TITLE --></div>
nduplessis
A: 

nduplessis, I like the sound of that! I'm almost ready to try that, except I also need my view to respond to button presses and things like that within the web view. Does using a web view complicate that aspect of things vs. using the usual cast of controls?

Joe D'Andrea