objective-cios4three20ttnavigator

How pass a parameter to a from:toObject:selector:?


I have a TableView with several rows. When a row is selected, I need to perform a selector. I do something like this:

 [TTTableTextItem 
  itemWithText:NSLocalizedString(@"Cash","Title:Cash")
  URL:[NSString @"tt://payment/add/%d",5]
  accessoryURL:[NSString stringWithFormat:detail,5]],

and declare:

 ..................... 
 TTURLMap* map = [TTNavigator navigator].URLMap;
 [map from:@"tt://payment/add/(source:)" toObject:self selector:@selector(addPayment:)];
 ..................... 

- (void) addPayment:(PaymentType)theType {
   ALog(@"%ld",theType);
}

But, theType always get 0. So, how I can pass the parameter?


Solution

  • One way (I think) is to do this:

    [map from:@"tt://payment/add/(addPayment:)" toObject:self];
    

    The addPayment: in parentheses implies what selector of self to invoke.