Room list order for iOS

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

User avatar
Prof_PP
Posts: 126
Joined: 07 Dec 2007, 08:53
Location: Austria
Contact:

Room list order for iOS

Postby Prof_PP » 15 Sep 2012, 16:04

Hi team, I know I have asked this before but now we are in a different era and a different client/server platform. Back in 2007, it was SFS1.x and Flash. Now it is SFS2.x and iOS.

"With the new version you will be able to specify that the RoomList (and UserList too) should not be sorted. In this case the rooms will be displayed from top to bottom according to their creation order. " - Lapo 2007

Much water has past under the bridge since then and now I actually do want the room list sorted, or more specifically, to display in the order of creation as promised.

I have created 4 rooms. Lets call them T1, E1, E2, E3. I created them in that order and the room id verifies this with consecutive ids.

But, when I list them in a UITableView in iOS, I get T1, E3, E1, E2 - no matter what I do. This code is the same as sample code, but does not appear to work or the server is not doing what it should.

Code: Select all

      SFSRoom *room = [[_smartFox.roomManager getRoomListFromGroup:@"Campus"] objectAtIndex:indexPath.row];
      cell.textLabel.text = [NSString stringWithFormat:@"%@ (%d/%d)", room.name, room.userCount, room.maxUsers];


I know I can resort the array on the iphone and then redisplay in the correct order, but I was hoping that they would display in the order created.

Any ideas what I may be doing wrong or what I can change?

Thanks in advance
Paul.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Room list order for iOS

Postby Lapo » 16 Sep 2012, 17:46

In general the client API doesn't keep an order for the Rooms in a Room List.
It's the client application that decides how to sort them based on the requirements of your project. It could be regular alphabetic order, or 2 groups of alphabetically ordered for Game and non-Game Rooms, it could be by ID etc...

If you use my last example (sorting by ID) you will get the Rooms ordered by creation.

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 20 guests