0

I'm populating an UITableView with MYSQL data from and external DB on my host,so i want display those data but on the inverse order,like,the first row become the last and the last be the first! Is there any way to do that on Xcode or i need to do this on MYSQL,how?

Jamal Tyson
  • 163
  • 3
  • 11
  • 1
    just reverse the data array. http://stackoverflow.com/questions/586370/how-can-i-reverse-a-nsarray-in-objective-c – macintosh264 Sep 15 '11 at 00:46

1 Answers1

0

Your SQL statement can order by whatever column(s) you want:

select * from mytable order by someColumn descending

The web service (rest, json, xml etc...) will return that data. How to you plan on exposing the data to your clients?

Your iPhone app will hold the results of that request in memory in something like a NSMutableArray of objects (or some other data structure).

When you implement UITableView directly or through a UITableViewController, you have to implement the tableView delegate callback methods. The UITableView is responsible for rendering the table and it calls back on you to get the data by passing you the row index. It's up to you to return the data for that row index. If you're holding the data for example, in an NSMutableArray which was returned from from your service request which did a select and order by on the database, it will simply return the data held in the index of that NSMutableArray.

For more info, check out a few related links: http://www.littlecomputers.net/2009/?page_id=549

http://www.icodeblog.com/2008/08/08/iphone-programming-tutorial-populating-uitableview-with-an-nsarray/

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

What exactly does delegate do in xcode ios project?

iPhone client server application

rest web services in iphone

Hope that helps.

Community
  • 1
  • 1
bryanmac
  • 38,941
  • 11
  • 91
  • 99