Wednesday, 28 August 2013

iOS (Objective C) I need these three stock options to be class level variables, so they are only declared and initialised once

iOS (Objective C) I need these three stock options to be class level
variables, so they are only declared and initialised once

I need the three stock options below to be declared and initialise only
once. I have got some pseudo code for it but unsure on how to make it
work.
This is declared in the M file of the iOS app and nothing is in the H file .
pseudo code for the below...
// _msftStockPrice _googStockPrice _applStockPrice need to be
class level
if(_msftStrockPrice == nil)
_googStockPrice = [[[CPDStockPriceStore sharedInstance]
monthlyPrices:CPDTickerSymbolMSFT]
if(_appleStrockPrice == nil)
_msftStockPrice = [[[CPDStockPriceStore sharedInstance]
monthlyPrices:CPDTickerSymbolMSFT]
if(_msftStrockPrice == nil)
_msftStockPrice = [[[CPDStockPriceStore sharedInstance]
monthlyPrices:CPDTickerSymbolMSFT]
if ([plot.identifier isEqual:CPDTickerSymbolAAPL] == YES) {
return [_appleStockPrice objectAtIndex:index];
} else if ([plot.identifier isEqual:CPDTickerSymbolGOOG] == YES) {
return [[_googStockPrice objectAtIndex:index];
} else if ([plot.identifier isEqual:CPDTickerSymbolMSFT] == YES) {
return [_msftStockPrice objectAtIndex:index];
*/

No comments:

Post a Comment