iphone SDK problems passing variables

Discussion in 'iOS Programming' started by MasterObiWan, Jan 18, 2009.

  1. MasterObiWan macrumors newbie

    Jan 12, 2009
    I am trying to pass an integer into a method, I get no errors however when I test in simulator the app crashes. Is there some sort of extra rule that I have to follow in order to pass variables in Objective C? :mad:
    Thanks if someone can help me. I've added comments to make the code easier to understand.

    - (void)whatMonthIsIt:(int)monthOfYear{
    	NSString* monthArray[5];
    	monthArray[1] = @"jan.png";
    	img_dates = [UIImage imageNamed:monthArray[monthOfYear]];     //sets img_dates to @"jan.png";
    - (void)onTimer:(NSTimer*)timer{    //Thread
    	NSDate *now;
    	int monthOfYear = [[now dateWithCalendarFormat:nil timeZone:nil]     monthOfYear];  //gets the current month and stores into integer monthOfYear
    	[self whatMonthIsIt:monthOfYear]; //passes monthOfYear to method whatMonthIsIt
    	[self setNeedsDisplay];
  2. MasterObiWan thread starter macrumors newbie

    Jan 12, 2009

Share This Page