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

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

Draw This
($0.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-24-2008, 01:56 AM   #3 (permalink)
daniel
New Member
 
Join Date: Jul 2008
Location: Bern, Switzerland
Posts: 9
daniel is on a distinguished road
Default

Hi scuba

I think what you're looking for is a dynamic array. Since dynamic arrays work with objects (they must be moved around via pointers), you have to convert your BOOL's in an object. You can do this e.g. with NSNumber.
Code:
NSNumber* myvalue = [NSNumber numberWithBool: TRUE];
If you compare Objective-C with javascript you have to be aware, that in Objective-c you're very close to the hardware. In js everything is boxed in an object. It's all simulated in a virtual machine and a garbage collector's there collecting all the objects you lost. Here you're dealing with real memory and you need to take care yourself of everything.
Welcome to the real world

Like Scotty mentioned, you could use C-Arrays. But thats not very comfortable in my opinion because you can't dynamically extend the array.
If you need just a fixed size array, do this:
Code:
BOOL myValues[] = {TRUE, FALSE, TRUE};
Daniel
daniel is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,020
Threads: 93,863
Posts: 401,920
Top Poster: BrianSlick (7,962)
Welcome to our newest member, wendolynlm80
Powered by vBadvanced CMPS v3.1.0

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