 |
 |
|
 |
01-15-2011, 07:04 PM
|
#1 (permalink)
|
|
Registered Member
Join Date: Sep 2010
Posts: 45
|
change a variable's number to according to a UILabel
Could someone please give me some code to make whatever number my UILabel is and change a specific int variable to that number?
|
|
|
01-15-2011, 07:05 PM
|
#2 (permalink)
|
|
Indie Developer
Join Date: Jul 2010
Posts: 1,346
|
Code:
int numberFromLabel = [label.text intValue]
Quote:
Originally Posted by Mr.Abe90
Could someone please give me some code to make whatever number my UILabel is and change a specific int variable to that number?
|
|
|
|
01-15-2011, 07:13 PM
|
#3 (permalink)
|
|
Registered Member
Join Date: Sep 2010
Posts: 45
|
Quote:
Originally Posted by iSDK
Code:
int numberFromLabel = [label.text intValue]
|
So where do I put the variable's name?
|
|
|
01-15-2011, 07:17 PM
|
#4 (permalink)
|
|
1026 Development
Join Date: Jul 2008
Age: 23
Posts: 1,094
|
Quote:
Originally Posted by Mr.Abe90
So where do I put the variable's name?
|
Uhh, in that example 'numberFromLabel' is the variable. You'd just replace that with your int.
|
|
|
01-15-2011, 07:25 PM
|
#5 (permalink)
|
|
Registered Member
Join Date: Sep 2010
Posts: 45
|
Quote:
Originally Posted by Jeremy1026
Uhh, in that example 'numberFromLabel' is the variable. You'd just replace that with your int.
|
That's what I did.
I also put my label's name before".text"
It's not working, do i change anything else in the code
Last edited by Mr.Abe90; 01-15-2011 at 07:29 PM.
|
|
|
01-15-2011, 07:30 PM
|
#6 (permalink)
|
|
Indie Developer
Join Date: Jul 2010
Posts: 1,346
|
put this line below the line where you are declaring the in:
Code:
NSLog(@"%d", numberFromLabel);
Post what you see in console.
Quote:
Originally Posted by Mr.Abe90
That's what I did.
I also put my label's name before".text"
It's not working, do i change anything else in the code
|
|
|
|
01-15-2011, 07:36 PM
|
#7 (permalink)
|
|
Registered Member
Join Date: Sep 2010
Posts: 45
|
Quote:
Originally Posted by iSDK
put this line below the line where you are declaring the in:
Code:
NSLog(@"%d", numberFromLabel);
Post what you see in console.
|
Nope still didn't work
|
|
|
01-15-2011, 07:37 PM
|
#8 (permalink)
|
|
Reading the Documentation
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
|
if you already have an instance variable declared then you don't need the 'int' at the beginning.
|
|
|
01-15-2011, 07:38 PM
|
#9 (permalink)
|
|
Indie Developer
Join Date: Jul 2010
Posts: 1,346
|
That wouldn't make it work. It will show an integer in console : cmd + shift + r
Quote:
Originally Posted by Mr.Abe90
Nope still didn't work 
|
|
|
|
01-16-2011, 06:38 PM
|
#10 (permalink)
|
|
1026 Development
Join Date: Jul 2008
Age: 23
Posts: 1,094
|
What is the value of the label when you are trying to get its intValue?
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 362 |
| 10 members and 352 guests |
| 7twenty7, blueorb, dre, iAppDeveloper, iGamesDev, Mah6447, Morrisone, mottdog, sacha1996, Touchmint |
| Most users ever online was 1,387, 04-10-2012 at 04:21 AM. |
» Stats |
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
|
| Welcome to our newest member, host number one |
|