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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-07-2010, 10:24 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 61
Default Get Child Object At Index?

I'm stuck at it again >_< this time I'm having trouble getting a child object from a parent.

I know to add a child there's addChild, but isn't there a way to access the children? Say I'm creating objects dynamically (like buttons), they're being created in a loop so therefore they're not being assigned to a global variable, but now that they don't have "real" names, but they're inside my parent object (say a UIView), would there be a way to assign a variable like "myObject" and just say childAtIndex:1 and it'd get the first child and assign it to myObject?

I saw that there's a childAtIndex command but I can't find any documentation on it, is it deprecated?


Thanks in advance
MediaChicken is offline   Reply With Quote
Old 09-07-2010, 10:40 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,072
Default

I don't see these child methods in the documentation, so I'm not sure where you found that.

Have a look at the UIView documentation for some useful methods.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

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

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 09-07-2010, 10:43 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 61
Default

Exactly, I couldn't find it in the documentation, yes when I start typing it it autocompletes it with that... unless it's because I'm using the Sparrow framework, maybe it's a method used in there..

Either way is there another way to get child objects?
MediaChicken is offline   Reply With Quote
Old 09-07-2010, 10:44 PM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,072
Default

Quote:
Originally Posted by BrianSlick View Post
Have a look at the UIView documentation for some useful methods.
.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

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

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 09-07-2010, 10:48 PM   #5 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 61
Default

I've been searching through, hence the reason I posted here...
MediaChicken is offline   Reply With Quote
Old 09-07-2010, 10:52 PM   #6 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 580
Default

Quote:
Originally Posted by MediaChicken View Post
I've been searching through, hence the reason I posted here...
In the UIView hierarchy, "children" are called "subviews", so look for that. There's a whole group of methods in the documentation under "Managing the View Hierarchy" that are related to what you need.
ChrisL is offline   Reply With Quote
Old 09-08-2010, 12:25 AM   #7 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 341
Default

Code:
- (SPDisplayObject *)childAtIndex:(int)index
__________________
17 year old nerd.
Send me a PM. Maybe I can help.
flamingliquid is online now   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
» Stats
Members: 157,864
Threads: 88,916
Posts: 379,299
Top Poster: BrianSlick (7,072)
Welcome to our newest member, MediaSolutions
Powered by vBadvanced CMPS v3.1.0

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