iphone - pass uigesturerecognzer data to parent controller -
there master view controller method
- (void)revealgesture:(uipangesturerecognizer *)recognizer{ }
which works when send mesage froma child viewcontroller using swipe:
uipangesturerecognizer *navigationbarpangesturerecognizer = [[uipangesturerecognizer alloc] initwithtarget:self.navigationcontroller.parentviewcontroller action:@selector(revealgesture:)]; [self.navigationcontroller.navigationbar addgesturerecognizer:navigationbarpangesturerecognizer];
i want pass message on within child viewcontroller can house keeping first
uipangesturerecognizer *navigationbarpangesturerecognizer = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(revealgesture:)]; [self.navigationcontroller.navigationbar addgesturerecognizer:navigationbarpangesturerecognizer];
and
- (void)revealgesture:(uipangesturerecognizer *)recognizer { [displaysearch resignfirstresponder]; revealcontroller *revealcontroller = [self.navigationcontroller.parentviewcontroller iskindofclass:[revealcontroller class]] ? (revealcontroller *)self.navigationcontroller.parentviewcontroller : nil; nsdictionary *data = [nsdictionary dictionarywithobjectsandkeys: recognizer, @"recognizer", nil]; [revealcontroller performselector:@selector(revealgesture:) withobject:data]; }
yes, i'm trying dismiss keyboard before carrying on bit of code works fine if target 'self.navigationcontroller.parentviewcontroller' directly
how add (uipangesturerecognizer *)recognizer nsdictionary?
my code crashes with
-[__nscfdictionary state]: unrecognized selector sent instance 0x8619860 2013-05-02 21:12:05.752 pwc uk[57884:c07] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfdictionary state]: unrecognized selector sent instance 0x8619860'
edit proposed solution worked keyboard didn't respond, needed chage line to
[self searchbarcancelbuttonclicked:searchbar];
where searchbar instance of uisearchbar
it looks revealgesture expecting uipangesturerecognizer parameter passing nsdictionary. try passing gesture recognizer directly.
[revealcontroller performselector:@selector(revealgesture:) withobject: recognizer];
Comments
Post a Comment