ios - Error calling action for button in Objective C -


i creating app in objective c, , receiving runtime error when press button in app. code creates buttons. yes have use coded version, before asks.

extend = [uibutton buttonwithtype:uibuttontyperoundedrect]; //3 [extend setframe:cgrectmake(100, 50, 75, 50 )]; [extend settitle:@"extend" forstate:uicontrolstatenormal]; [extend addtarget:self action:@selector(extendpressed:) forcontrolevents:uicontroleventtouchupinside]; [self.view addsubview:extend]; [self.view bringsubviewtofront:extend];  retract = [uibutton buttonwithtype:uibuttontyperoundedrect]; //3 [retract setframe:cgrectmake(100, 110, 75, 50 )]; [retract settitle:@"retract" forstate:uicontrolstatenormal]; [extend addtarget:self action:@selector(retractpressed:) forcontrolevents:uicontroleventtouchupinside]; [self.view addsubview:retract]; [self.view bringsubviewtofront:retract]; 

and here actions.

- (ibaction)extendpressed:(uibutton *)sender{      nslog(@"extend");  }  - (ibaction)retractpressedpressed:(uibutton *)sender{      nslog(@"retract");  } 

when press retract button, nothing happens, when press extend button, app crashes , shows in debug console:

2013-07-31 16:57:49.479 drive 3.0[1557:907] extend 2013-07-31 16:57:49.482 drive 3.0[1557:907] -[driveviewcontroller retractpressed:]: unrecognized selector sent instance 0x1f564730 2013-07-31 16:57:49.483 drive 3.0[1557:907] * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[driveviewcontroller retractpressed:]: unrecognized selector sent instance 0x1f564730' * first throw call stack: (0x33c9e3e7 0x3b999963 0x33ca1f31 0x33ca064d 0x33bf8208 0x35b98087 0x35b9803b 0x35b98015 0x35b978cb 0x35b97db9 0x35ac05f9 0x35aad8e1 0x35aad1ef 0x377c55f7 0x377c5227 0x33c733e7 0x33c7338b 0x33c7220f 0x33be523d 0x33be50c9 0x377c433b 0x35b012b9 0x1a229 0x19f88) libc++abi.dylib: terminate called throwing exception

thank in advance able , tell me doing wrong.

you have typo in method name:

retractpressedpressed 

should be:

retractpressed 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -