简体   繁体   English

如何在iOS中使用模式图像在可扩展的tableViewCell中设置UIButton

[英]How to set UIButton in expandable tableViewCell with pattern Image in ios

In my table view, I want to set pattern Image to the Custom button in expandable cell in each row of my table view. 在我的表格视图中,我想将图案图像设置为表格视图每一行中可扩展单元格中的“自定义”按钮。

which method I can use for it? 我可以使用哪种方法?

please help me. 请帮我。

Generally at the appropriate time you should call: 通常,您应该在适当的时候致电:

[myButton setImage:image forState:state]

The appropriate time might be in tableView:cellForRowAtIndexPath: , or tableView:willDisplayCell: . 适当的时间可能在tableView:cellForRowAtIndexPath:tableView:willDisplayCell:

尝试这个:

[yourbutton setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"Your Image name"]]];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM