Beginner with iOS - SIGABRT when referring to a simple method in my app? -


i'm starting ios development, trying call method(function?) in code. in .h file have:

- (void)changecolour; 

in .m file have:

- (ibaction)leftswipedetected:(uiswipegesturerecognizer *)sender {      [self changecolour];  }  - (void)changecolour {     colourcount++;      switch (colourcount)     {         case 1:              self.view.backgroundcolor = [uicolor redcolor];             break;          case 2:              self.view.backgroundcolor = [uicolor bluecolor];             break;     } } 

this prompts sigabrt abandonment when run program, didn't when didn't try calling method. there wrong this?

thanks.

ok way try this,


  @interface viewcontroller ()   {      int count;   }    @end    @implementation viewcontroller    - (void)viewdidload   {       [super viewdidload];         // additional setup after loading view, typically nib.        uiswipegesturerecognizer *rec = [[uiswipegesturerecognizer alloc]initwithtarget:self action:@selector(leftswipedetected:)];       rec.direction = uiswipegesturerecognizerdirectionleft;       [self.aview addgesturerecognizer:rec];       [rec release];       count = 0;     }     - (void)didreceivememorywarning    {       [super didreceivememorywarning];       // dispose of resources can recreated.    }      - (void)dealloc {             [_aview release];             [super dealloc];         }       -(void)leftswipedetected:(uiswipegesturerecognizer *)sender     {             [self changecolor];     }      -(void)changecolor     {             count++;             switch (count) {                 case 1:                     {                         self.aview.backgroundcolor = [uicolor blackcolor];                         break;                     }                 case 2:                 {                     self.aview.backgroundcolor = [uicolor greencolor];                     break;                 }                 default:                 break;             }         if(count == 2)         {             count = 0;         }     }   @end 



Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -