如何将参数传递给 from:toObject:selector:?
我有一个包含几行的 TableView。当选择一行时,我需要执行选择器。我做了这样的事情:
[TTTableTextItem
itemWithText:NSLocalizedString(@"Cash","Title:Cash")
URL:[NSString @"tt://payment/add/%d",5]
accessoryURL:[NSString stringWithFormat:detail,5]],
并声明:
.....................
TTURLMap* map = [TTNavigator navigator].URLMap;
[map from:@"tt://payment/add/(source:)" toObject:self selector:@selector(addPayment:)];
.....................
- (void) addPayment:(PaymentType)theType {
ALog(@"%ld",theType);
}
但是,theType 总是得到 0。那么,我如何传递参数呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种方法(我认为)是这样做:
括号中的
addPayment:
暗示要调用的self
选择器。One way (I think) is to do this:
The
addPayment:
in parentheses implies what selector ofself
to invoke.你的数据源是什么?表视图不存储自己的数据。您使用了正确的协议吗?
What is your datasource? Table Views do not store their own data. Have you used the correct protocal?