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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 01-12-2010, 09:52 PM   #9 (permalink)
MobileGeorge
Registered Member
 
Join Date: Jan 2010
Posts: 1
Default

Quote:
Originally Posted by exorcyze View Post
Code:
// in your .h
@interface MyListClass : NSObject {
    NSArray *list;
}
@property (nonatomic, retain) NSArray *list;

// in your .m
@synthesize list;
- (void) dealloc {[list release];
    [super dealloc];
}
// whereever you set it up ( init most likely ):
NSArray *temp = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:1], [NSNumber numberWithInt:2], [NSNumber numberWithInt:3], nil];
self.list = temp;
[temp release];
There is no need to create an array of NSNumber objects if you only want integer values.

Code:
// in your .h
@interface MyListClass : NSObject {
    const int *list;
}
@end

// in your .m
@implementation MyListClass
static const int constList[5] = {1, 2, 3, 4, 5};
...and in init:
list = constList;
@end

Last edited by MobileGeorge; 01-12-2010 at 10:13 PM.
MobileGeorge is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,851
Threads: 89,215
Posts: 380,665
Top Poster: BrianSlick (7,129)
Welcome to our newest member, suseline113
Powered by vBadvanced CMPS v3.1.0

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