|Apr 30, 2006, 03:33 PM||#1|
A little help? (xCode and Obj C)
Im getting started with xcode and objective-c.
I did 1st year at uni doing programming but I left after the first year. I wasnt very good and it was a while ago...but I thought it would be fun to give some programming a go again.
If I add to variables together... previousNumber and currentNumber, both declared as floats.
Say previousNumber is 6 and current is 0.1, and i display the answer in a textfield created with the xcode interface builder. I'm get 6.10000 and then a load of numbers.
Is this because I have to limit the amount of characters displayed? How would I do that?
Also when I build an app which is to be bootable on another machine how do I do that. I build the project. Theres an app in the build folder but I guess it needs some of the other files in there.
Thanks in advance
|Apr 30, 2006, 04:10 PM||#2|
float aFloat = previousNumber + current; [aTextField setStringValue:[NSString stringWithFormat:@"%.1f", aFloat]];
|May 1, 2006, 09:12 AM||#5|
Is that at outlets section in the header file?
Also, if I have a function. I have problems if Im using int and float together.
ie if I multiply the float variable by the int variable and use retval (which I set as a float) it only returns the whole number, not the decimal part.
Thanks again for the help guys.
I've tried as a project to make a calculator, which isnt as easy as i thought. It works fine apart from inputing decimals. The codes ugly though.......
I'm going to try getting dictionarys to work next.! I want different dictionaries in an array. I find it quite difficult, especially the memory management side. Though theres a nice tutorial about making an address book at the o'reilly site where he does just that though.
|May 1, 2006, 12:02 PM||#6|
There must be something else that causes it. Try to log the different variables at different stages, watch what happens in the debugger or post the method/function here for someone to look at.
Someone get Nekkid™, now!
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Getting started with XCode/Obj-C but have some outdated books.||MikeonTV||iPhone/iPad Programming||8||Apr 8, 2014 04:11 PM|
|Moving from xcode 3.2 to xcode 4.5.2 compilation error for 'abs' macro in stdlib.h||hrishidev||Mac Programming||7||Jun 2, 2013 11:36 AM|
|Interested in learning Obj-C/Xcode what are some good resources?||hugodrax||Mac Programming||3||Nov 10, 2012 10:07 PM|
|What to learn aside Obj C||Will0827||iPhone/iPad Programming||8||Sep 27, 2012 04:07 PM|
|Need help with indexing (Java or Obj-C)||iVikD||Mac Programming||5||Jul 5, 2012 06:43 PM|
All times are GMT -5. The time now is 07:59 PM.