objective-c - Button传值怎么传?
伊谢尔伦
伊谢尔伦 2017-05-02 09:24:03
0
2
462


我想把row传到plusEvent方法里 不知道怎么做 没百度到

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
PHPzhong

1. The simplest way is to use the button tag to pass the value. But this is not a recommended approach. . And only int type can be passed.
2. You can customize a button to inherit UIButton and use data as an attribute. (Recommended)
3. You can add a category. Use runtime Associative technology to force the addition of a data attribute. (Key recommendation)
Associative technology, you can see the Associative node demo in this article: click to enter

淡淡烟草味

plusBtn.tag = indexPath.row;
Then sender.tag

in plusEvent:
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template