ios - 输入人数后如何改变image
PHPz
PHPz 2017-04-17 17:52:12
0
6
314

![图片上传中...]

问题是这样的:点击cell 然后cell的图片会改变,同时吧image设置成可以交互的状态,然后增加了alert对话框,这些都没问题,但是我需要在输入数字之后改变image的图片,这个应该怎么去实现?

PHPz
PHPz

学习是最好的投资!

reply all(6)
黄舟

You should be using UICollectionView. The image of each Cell should be set in the cellForItemAtIndexPath callback according to the Model data (such as imagePath) corresponding to the Cell. After you change the number through the Alert dialog box, you can modify the corresponding data of the Cell (imagePath and the like) in the response method of AlertAction, and then reloadData.

Another idea is that when you click on the Cell, you can get the indexPath of the Cell. Then after you change the number through the Alert dialog box, you can take this indexPath in the response method of AlertAction to call cellForItemAtIndexPath to get the Cell. Then just take this Cell object and modify its image.

Ty80

The callback method setImage is determined at the alert point

刘奇

Write a protocol in the cell to call back the view controller

Ty80

Set in AlertAction BLOCK

迷茫

ReloadData() directly after setting the data, this is the simplest

Ty80

After the setting is completed, just use the reload method. This function can be implemented by customizing the Delegate through the proxy or using a block. Of course, notifications are also available. It just tells the view that the event needs to be reloaded

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