Question

I store some floats in my app delegate, then synthesise it in the .m of the app delegate.

Now when I come to use that float in one view controller I do this:

del = [[UIApplication sharedApplication] delegate];
CGFloat PUEresult = (*(del.FacilitiesLoad) / *(del.ItLoad));

(ItLoad and FacilititesLoad are both the floats stored in my delegate)

Now in the next controller I do the same thing:

CGFloat localPUE = (*(del.FacilitiesLoad) / *(del.ItLoad));

That always returns inf why is this and how do I stop it doing this?

I've not been working with obj-c for long so be nice please.

Removing pointers does this:

Invalid operands to binary expression ('CGFloat *' (aka 'float *') and 'CGFloat *')

Was it helpful?

Solution

CGFloat is a primitive type, no needs to use * symbol. Try to remove it in all places where you use CGFloat and check result again

Don't forget to cast youp app delegate to your type:

del = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top