开发者

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

开发者 https://www.devze.com 2023-03-10 06:05 出处:网络
I have a TableView with several rows. When a row is selected, I need to perform a selector. I do something like this:

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:[NSStrin开发者_开发知识库g @"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?


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.


What is your datasource? Table Views do not store their own data. Have you used the correct protocal?

0

精彩评论

暂无评论...
验证码 换一张
取 消