• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: problem with floats/floatForKey
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with floats/floatForKey


  • Subject: Re: problem with floats/floatForKey
  • From: Duncan Campbell <email@hidden>
  • Date: Thu, 21 Apr 2005 16:50:58 +1000

Seems my problem was in initializing my NSDefaults variable - I was doing so in awakeFromNib, and it didn't seem to be read correctly in another method in the same class...

thx for the help.

On 21-Apr-05, at 4:40 PM, Magnus Strand wrote:

Hi Duncan,

I can't see any error in your code,
Have you checked myVar:s value before and after assignment with the debugger?


Magnus Strand

Duncan Campbell wrote:

Hey folks.

If i do the following:

NSLog(@"direct from Defaults: %f",[defaults floatForKey:@"myFloatKey"]);

I get the value I want.

However, if I do this:

float myVar = [defaults floatForKey:@"myFloatKey"];
NSLog(@"after assignment: %f",myVar);

I get a very funky value for "myVar".

What am I doing wrong here?

Cheers.

---------------------------------------------------------------
Duncan Campbell
http://www.duncanandsarah.com/duncan
---------------------------------------------------------------


---------------------------------------------------------------------- --


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden



--
*Magnus Strand *
Systemutvecklare | System Developer, MSc

*Teknik i Media* | Södra Förstadsgatan 2 | 211 43 Malmö | Tel +46 40 601 57 00 | Fax +46 40 601 57 99
Direkt +46 40 601 57 16 | Mobil +46 704 20 57 16 | email@hidden | www.tim.se


/This message contains information that may be privileged or confidential and is the property of Teknik i Media. / /It is intended only for the person to whom it is addressed. If you receive this message in error, please notify the sender immediately and delete all copies of this message. /




--------------------------------------------------------------- Duncan Campbell http://www.duncanandsarah.com/duncan ---------------------------------------------------------------

The so-called "desktop metaphor" of today's workstations is instead an
"airplane-seat" metaphor. Anyone who has shuffled a lap full of papers
while seated between two portly passengers will recognize the difference --
one can see only a very few things at once.
-- Fred Brooks


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >problem with floats/floatForKey (From: Duncan Campbell <email@hidden>)
 >Re: problem with floats/floatForKey (From: Magnus Strand <email@hidden>)

  • Prev by Date: Re: problem with floats/floatForKey
  • Next by Date: Re: Feature suggestions for easier debugging of Cocoa Bindings.
  • Previous by thread: Re: problem with floats/floatForKey
  • Next by thread: Cocoa/PB/IB weirdness
  • Index(es):
    • Date
    • Thread