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

Reply
 
LinkBack Thread Tools Display Modes
Old 01-15-2011, 07:04 PM   #1 (permalink)
Registered Member
 
Mr.Abe90's Avatar
 
Join Date: Sep 2010
Posts: 45
Mr.Abe90 is on a distinguished road
Arrow 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?
Mr.Abe90 is offline   Reply With Quote
Old 01-15-2011, 07:05 PM   #2 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,346
iSDK is on a distinguished road
Send a message via AIM to iSDK
Default

Code:
int numberFromLabel = [label.text intValue]
Quote:
Originally Posted by Mr.Abe90 View Post
Could someone please give me some code to make whatever number my UILabel is and change a specific int variable to that number?
iSDK is offline   Reply With Quote
Old 01-15-2011, 07:13 PM   #3 (permalink)
Registered Member
 
Mr.Abe90's Avatar
 
Join Date: Sep 2010
Posts: 45
Mr.Abe90 is on a distinguished road
Default

Quote:
Originally Posted by iSDK View Post
Code:
int numberFromLabel = [label.text intValue]
So where do I put the variable's name?
Mr.Abe90 is offline   Reply With Quote
Old 01-15-2011, 07:17 PM   #4 (permalink)
1026 Development
 
Join Date: Jul 2008
Age: 23
Posts: 1,094
Jeremy1026 is on a distinguished road
Send a message via AIM to Jeremy1026
Default

Quote:
Originally Posted by Mr.Abe90 View Post
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.
Jeremy1026 is offline   Reply With Quote
Old 01-15-2011, 07:25 PM   #5 (permalink)
Registered Member
 
Mr.Abe90's Avatar
 
Join Date: Sep 2010
Posts: 45
Mr.Abe90 is on a distinguished road
Default

Quote:
Originally Posted by Jeremy1026 View Post
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.
Mr.Abe90 is offline   Reply With Quote
Old 01-15-2011, 07:30 PM   #6 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,346
iSDK is on a distinguished road
Send a message via AIM to iSDK
Default

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 View Post
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
iSDK is offline   Reply With Quote
Old 01-15-2011, 07:36 PM   #7 (permalink)
Registered Member
 
Mr.Abe90's Avatar
 
Join Date: Sep 2010
Posts: 45
Mr.Abe90 is on a distinguished road
Default

Quote:
Originally Posted by iSDK View Post
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
Mr.Abe90 is offline   Reply With Quote
Old 01-15-2011, 07:37 PM   #8 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

if you already have an instance variable declared then you don't need the 'int' at the beginning.
baja_yu is offline   Reply With Quote
Old 01-15-2011, 07:38 PM   #9 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,346
iSDK is on a distinguished road
Send a message via AIM to iSDK
Default

That wouldn't make it work. It will show an integer in console : cmd + shift + r
Quote:
Originally Posted by Mr.Abe90 View Post
Nope still didn't work
iSDK is offline   Reply With Quote
Old 01-16-2011, 06:38 PM   #10 (permalink)
1026 Development
 
Join Date: Jul 2008
Age: 23
Posts: 1,094
Jeremy1026 is on a distinguished road
Send a message via AIM to Jeremy1026
Default

What is the value of the label when you are trying to get its intValue?
Jeremy1026 is offline   Reply With Quote
Reply

Bookmarks

Tags
label, number, variable

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
» 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
Powered by vBadvanced CMPS v3.1.0

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