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

View Single Post
Old 09-09-2009, 03:33 PM   #16 (permalink)
freshking
Registered Member
 
Join Date: Oct 2008
Location: Munich, Germany
Posts: 108
freshking is on a distinguished road
Default

Im probably doing something really dumb but here you go:

Quote:
typedef enum _StringType
{
Input, Received
} StringType;

@interface MyObject: NSObject
{
NSString* theString;
StringType type;

}
@property (nonatomic, readonly) NSString* theString;
@property (readonly) StringType type;

-(id) initWithString: (NSString*) aString andType: (StringType)type;

@end

@implementation MyObject

-(id) initWithString: (NSString*) aString andType: (StringType)type{

return theString;
}

@synthesize theString, type;

@end
Quote:
//when something new is input by the user
MyObject* obj = [[MyObject alloc] initWithString:input.text andType: Input];
[services addObject: obj];
[obj release];
Quote:
//when you recieve something over wifi
MyObject* obj = [[MyObject alloc] initWithString: output andType: Received ];
[services addObject: obj];
[obj release];
Quote:
MyObject* obj = [services objectAtIndex:indexPath.row];

if (obj.type == Received) {
//whatever
} else if (obj.type == Input) {
//whatever
}
freshking is offline   Reply With Quote
 

» Advertisements
» Online Users: 689
22 members and 667 guests
Absentia, ADY, ayesha25, baja_yu, Bertrand21, BrianSlick, coolman, dacapo, dremayl49, Gaz, gbenna, kapps11, kosicki123, linkmx, msovani, mutantskin, nobre84, pipposanta, QuantumDoja, rivers123, SLIC, trunglee
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,181
Threads: 93,921
Posts: 402,155
Top Poster: BrianSlick (7,968)
Welcome to our newest member, ayesha25
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:32 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.