Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-02-2011, 12:32 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 105
jasonbfly is on a distinguished road
Default Display Uitableview minus first character

Hello,
I am still pretty new to Xcode and struggling with sorting an NSMutableDictionary inside my TableView.
The best i can do is sort it Alphabetically but that is not the order in which i want it to display.
I figured that if i add a letter to the begining of each key like so:
AEp 1
BEp 2
CEp 3
etc...
I could sort it alphabetically like that. How ever i do not want that letter to be displayed when it is shown in the cell of the tableView. Does anyone know how to display the key, but take out the first character of the keys.
Thanks for any help at all
-Jason.

Last edited by jasonbfly; 12-02-2011 at 12:34 PM. Reason: minor typo
jasonbfly is offline   Reply With Quote
Old 12-02-2011, 12:55 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

I suspect you're making this too hard. What does your actual data look like, and what determines the order you want it to be displayed?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 12-03-2011, 01:27 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 105
jasonbfly is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
I suspect you're making this too hard. What does your actual data look like, and what determines the order you want it to be displayed?
Thanks for the reply, my data looks like this:

episodes = [[NSMutableDictionary alloc]init];


[episodes setObject:@"Info for episode 1" forKey:@"Episode 1 Name"];
[episodes setObject:@"Info for episode 2" forKey:@"Episode 2 Name"];[episodes setObject:@"Info for episode 3" forKey:@"Episode 3 Name"];[episodes setObject:@"Info for episode 4" forKey:@"Episode 4 Name"];
[episodes setObject:@"Info for episode 5" forKey:@"Episode 5 Name"];
[episodes setObject:@"Info for episode 6" forKey:@"Episode 6 Name"];
[episodes setObject:@"Info for episode 7" forKey:@"Episode 7 Name"];

datasource = [[episodes allKeys] sortedArrayUsingSelector:@selector(caseInsensitive Compare:)];

So i would like to display and sort the information in my tableview, which it does at the moment, but it does it in alphabetical order because of the line:

datasource = [[episodes allKeys] sortedArrayUsingSelector:@selector(caseInsensitive Compare:)];

I would like display it in the tableview in a custom view, from episode 1-7.
Thanks for your help :)
jasonbfly is offline   Reply With Quote
Old 12-03-2011, 01:39 PM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Make a model class. Ex:

Code:
// Episode.h

@interface Episode : NSObject;
{
}

@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *info;
@property (nonatomic, copy) NSNumber *sortOrder;

@end
Fill those with information as needed, put them into an array, sort as desired.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 12-03-2011, 05:43 PM   #5 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 105
jasonbfly is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Make a model class. Ex:

Code:
// Episode.h

@interface Episode : NSObject;
{
}

@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *info;
@property (nonatomic, copy) NSNumber *sortOrder;

@end
Fill those with information as needed, put them into an array, sort as desired.

Would you be able to give me an example of how to fill that all in? and than how would i get it to display in the cell, with episode name, than once that cell is clicked to display the info? Thanks for the help and speady responce
jasonbfly is offline   Reply With Quote
Old 12-03-2011, 05:46 PM   #6 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Code:
Episode *episode = [[Episode alloc] init];
[episode setName:@"Name of episode"];
[episode setInfo:@"Stuff about episode"];
[episode setSortOrder:[NSNumber numberWithInt:0]];

[[self listOfEpisodes] addObject:episode];

[episode release], episode = nil;
You're going to have to figure out the rest for yourself.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 12-03-2011, 05:49 PM   #7 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 105
jasonbfly is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Code:
Episode *episode = [[Episode alloc] init];
[episode setName:@"Name of episode"];
[episode setInfo:@"Stuff about episode"];
[episode setSortOrder:[NSNumber numberWithInt:0]];

[[self listOfEpisodes] addObject:episode];

[episode release], episode = nil;
You're going to have to figure out the rest for yourself.
Ok, thanks a lot for your help
jasonbfly is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 401
16 members and 385 guests
7twenty7, AppsBlogger, Clouds, David-T, dedeys78, Duncan C, e2applets, EvilElf, HemiMG, heshiming, iekei, LunarMoon, Murphy, sacha1996, Sami Gh, teebee74
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,914
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:43 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0