0

I am working on a iphone app, and I am just learning iphone app development for weeks, so I have some questions here : this app will load many posts from a remote server, and the post is consist of one text field, one image, and three buttons (good, bad and comment). There are thousands of posts on the server, so I thought the app will load three posts each time, and when the user scroll up the page, it will continue to load the previous post, and if the user scroll down the page, it will continue to load the next post. For being a newbie, I don't know what View is good for it, any advice is appreciated.

I have tried :

  1. UIView + UIScrollView + Label / Image / Buttons (post)
  2. UIView + UITableView + UITableViewCell (Label, image, buttons)

The first one is fine, and the second one, I really don't know how to make it in the second option..so what view pattern is good for this?

Tom
  • 4,612
  • 4
  • 32
  • 43

2 Answers2

0

You are going to want to use a UITableView for almost all content in a list view. UITableView recycles is cells to save memory, so it can handle far more items than the just a bunch of uiviews in a scrollview I would start by reading up on the UITableview docs, and looking up some tutorials on custom UITableView cells.

here is the docs:

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html

personally I have a little library that I setup with custom UITableViewCell (via subclassing) to do this. You will also want to setup a model that works with the paging of your remote server (3 at a time you stated). So on the last post you will want to add a custom load more cell that when tapped, will get page 2 then lather,rinse,repeat. Any questions let me know.

daltoniam
  • 579
  • 7
  • 13
  • Thank you for your advices, and I am working on it now, will see if it's working. – Tom Apr 30 '12 at 00:29
  • Hey daltoniam, your idea is good, but for my project, I decide to make it in another way. The project is on a limited schedule, I don't have enough time to learn it. What I have done, is to use a toobar at the top of the View act as a menu for different pages. For each page, I use WebView to load the post (Ajax), you know HTML is quite simpler one. Also I add another View for button, make a JS, OBJECTIVE C bridge - that's in safari JS guide. And it working fine, the client is satisfied with this version so far. Still thank you for your contribution. – Tom May 01 '12 at 03:42
0

You should go with the UITableView option. To tell if the user has scrolled to the bottom, look at this link.

Also, start the easy way. Just use the standard UITableViewCell and set the detailText label to your downloaded post title. Once you figure this out along with handling the scrolling and automatically downloading new posts then update the cell to handle images and additional content.

Community
  • 1
  • 1
bbarnhart
  • 6,620
  • 1
  • 40
  • 60