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 igzhelper
or alter target accountsettingviewcontroller
class:
-(void)donewithnumberpad{ [self.phonenumbertf resignfirstresponder]; }
ios objective-c xcode
Comments
Post a Comment