objective c - Limit to adding objects to a performSelector request (iOS4) -
if use code, app works:
if ([self.navigationcontroller respondstoselector:@selector(showupdaterecordmodalwithfrontword:andbackword:)]) { nslog(@"seems respond"); [self.navigationcontroller performselector:@selector(showupdaterecordmodalwithfrontword:andbackword:) withobject:[currentcard frontword] withobject:[currentcard backword]]; }
if add third parameter (below), sigabrt.
if ([self.navigationcontroller respondstoselector:@selector(showupdaterecordmodalwithfrontword:andbackword:andnotes:)]) { nslog(@"seems respond"); [self.navigationcontroller performselector:@selector(showupdaterecordmodalwithfrontword:andbackword:andnotes:) withobject:[currentcard frontword] withobject:[currentcard backword] withobject:[currentcard notes]]; }
the method here:
- (id)showupdaterecordmodalwithfrontword:(nsstring *)arg_name1 andbackword:(nsstring *)arg_name2 andnotes:(nsstring *)arg_name3 { nslog(@"%s", __function__); appproductmodalcontroller *modal = [[appproductmodalcontroller alloc] initwithnibname:nil bundle:nil]; [modal setnewrecord: no]; [modal setdelegate: self.topviewcontroller]; [modal.navbar.topitem settitle: @"update card"]; [modal.frontwordfield settext: arg_name1]; [modal.backwordfield settext: arg_name2]; [modal.notesfield settext: arg_name3]; [self presentmodalviewcontroller:modal animated:yes]; [modal release]; return nil; }
am running limit of parameters, or doing wrong?
i appreciate help..
nsobject defines performselector:
, performselector:withobject:
, performselector:withobject:withobject:
. there's no magic behind scenes here you're "adding objects" — there isn't such method performselector:withobject:withobject:withobject:
. best solution send message directly rather going through performselector:
. selector doesn't vary, shouldn't problem.
Comments
Post a Comment