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-12-2008, 05:05 PM   #9 (permalink)
rames44
Mobile Geek
 
Join Date: Aug 2008
Location: Florida, USA
Posts: 365
rames44 is on a distinguished road
Send a message via AIM to rames44 Send a message via Yahoo to rames44
Default

Quote:
Originally Posted by roberthuttinger View Post
so if i have an array that has 1 item in it, it will load the label with the text from a arrayItem[1] and show the delete button, and there is no info after that . so what id like to do is a for statement...
HTML Code:
for(i=0; i=arrayItems.count;i++) {
itemListText [###how do I increment this?###].text = [NSString stringWithFormat:@"%@ - %@", [[mainDelegate.personArray objectAtIndex:0] itemTitle], [[mainDelegate.personArray objectAtIndex:0] itemAddtl]];
remove2Button.hidden = NO;
}
How can I make the number of the label at the end a variable on the fly?

for example:
itemListText1
itemListText2
itemListText3 etc

rob
So what's wrong with making "itemListText" an array (i.e. itemListText[3] instead of itemListText1, itemListText2 and itemListText3), making removeButton and array (i.e. removeButton[3] instead of remove1Button, remove2Button and remove3Button) and then doing:
Code:
for(i=0; i=arrayItems.count;i++) {
itemListText[i].text = [NSString stringWithFormat:@"%@ - %@", [[mainDelegate.personArray objectAtIndex:0] itemTitle], [[mainDelegate.personArray objectAtIndex:0] itemAddtl]];
removeButton[i].hidden = NO;
}
About the only issue I can think of is that you probably have to create the various items, buttons, etc. programmatically instead of creating them in InterfaceBuilder (since IB won't be able to inject into an array, I suspect) but that isn't hard. But that may actually be a good thing, since it would allow you to create the number of objects that match the number of items in your array, as opposed to having a fixed number.

Or am I just missing something fundamental in what you're trying to do?
rames44 is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,545
Threads: 94,070
Posts: 402,690
Top Poster: BrianSlick (7,989)
Welcome to our newest member, ceolacc18
Powered by vBadvanced CMPS v3.1.0

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