ios - -[IgzHelper doneWithNumberPad]: unrecognized selector sent to instance 0x1923c230' -



ios - -[IgzHelper doneWithNumberPad]: unrecognized selector sent to instance 0x1923c230' -

i created helper class, returns uitoolbar , issue error "terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[igzhelper donewithnumberpad]: unrecognized selector sent instance 0x1923c230'"

//#igzhelper.h -(uitoolbar *)createdonefornumberpad:(sel)sel; //#igzhelper.m -(uitoolbar *)createdonefornumberpad:(sel)sel{ uitoolbar* numbertoolbar = [[uitoolbar alloc]initwithframe:cgrectmake(0, 0, 320, 50)]; numbertoolbar.barstyle = uibarstyleblacktranslucent; numbertoolbar.items = [nsarray arraywithobjects: [[uibarbuttonitem alloc]initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil], [[uibarbuttonitem alloc]initwithtitle:@"done" style:uibarbuttonitemstyledone target:self action:sel], nil]; numbertoolbar.tintcolor = [uicolor whitecolor]; [numbertoolbar sizetofit]; homecoming numbertoolbar; }

this class "accountsettingviewcontroller" calling igzhelper createdonefornumberpad

this code "sorry bad english language guy please help me"

- (void)viewdidload { [super viewdidload]; // additional setup after loading view. self.phonenumbertf.inputaccessoryview = [igzhelper createdonefornumberpad:@selector(donewithnumberpad)]; } -(void)donewithnumberpad{ [self.phonenumbertf resignfirstresponder]; }

you have crash because igzhelper don't know method donewithnumberpad. methode defined in accountsettingviewcontroller telleing toolbar defined in igzhelper.

numbertoolbar.items = [nsarray arraywithobjects: [[uibarbuttonitem alloc]initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil], [[uibarbuttonitem alloc]initwithtitle:@"done" style:uibarbuttonitemstyledone target:self action:sel], nil];

you putting target self witch igzhelper methode défined in accountsettingviewcontroller.

put method in igzhelperor alter target accountsettingviewcontrollerclass:

-(void)donewithnumberpad{ [self.phonenumbertf resignfirstresponder]; }

ios objective-c xcode

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -