将值从 UIButton 传递到 UIActionSheet
我正在尝试从按钮向 ActionSheet 发送一个变量。
我无法使用标签属性,因为它被用于其他用途。
我已将 myIndexRow 声明为实例变量并具有:
NSInteger myIndexRow = indexPath.row;
[deleteButton addTarget:self action:@selector(showDeleteSheet:) forControlEvents:UIControlEventTouchUpInside];
deleteButton.myIndexRow = myIndexRow;
但我收到“对成员“myRow”的请求不是结构或联合”
此处明显缺少一些内容。
I'm trying to send an ActionSheet a variable from a button.
I can't use the tag property because its being used for something else.
I've declared myIndexRow as an instance variable and have:
NSInteger myIndexRow = indexPath.row;
[deleteButton addTarget:self action:@selector(showDeleteSheet:) forControlEvents:UIControlEventTouchUpInside];
deleteButton.myIndexRow = myIndexRow;
but I'm getting the 'Request for member 'myRow' is something not a structure or union'
There is something obvious I am missing here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从来没想过我会回答我自己的问题,但这里是:
访问超级视图的超级视图并查询索引路径部分和行属性就可以了。
在按钮的目标中:
然后在actionSheet的clickedButtonAtIndex方法中,我得到了我需要的行:
找到了部分答案在另一篇文章中以及其余的此处
Never figured I'd answer my own question on SO but here goes:
Accessing the superview's superview and querying the indexPath section and row properties did the trick.
In the target of the button:
Then down in the actionSheet's clickedButtonAtIndex method I get the row I need:
Part of the answer was found in another post and and the rest here