Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

animefx

macrumors regular
Original poster
May 10, 2005
157
0
Illinois
What I'm wanting to do is take the users input in myTextView and display 1 through the number they input on myLabel. For some reason this isn't working... I'm frustrated because it's not easy assigning objects to traditional variable types like int, etc. Please don't over complicate the code if you can help me out. Thanks!

I have this inside an action of button touch up inside btw...

Code:
NSString *ValueOfTextField; //object to hold myTextView.text

ValueOfTextField = myTextView.text; //assigning value

for (int i = 1; i <= [ValueOfTextField intValue]; i++) { 

myLabel.text = myLabel.text && "@\n" && ValueOfTextField;

}
 
You should try using the NSString method stringByAppendingString

so pretend myString is your NSString

Code:
myString = [myString stringByAppendingString:@"whatever_you_want_to_add"]

give this a shot

I would create the NSString outside of the loop, build it in the loop, and then after the loop assign it to the text property of the label
 
Last edited by a moderator:
Thank you! This is exactly what I was looking for :)

You should try using the NSString method stringByAppendingString

so pretend myString is your NSString

Code:
myString = [myString stringByAppendingString:@"whatever_you_want_to_add"]

give this a shot

I would create the NSString outside of the loop, build it in the loop, and then after the loop assign it to the text property of the label
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.