在我的App中有很多地方用到了ActionSheet,最近发布了一个版本,由于测试忘记测相机了,导致上线后发现一个bug,相机的ActionSheet占据了第一和第一的位置,结果当别的地方点击actionsheet前两个的时候都会跳转到相机或者是相册,请问大家怎么解决这个问题呢?
大家讲道理2017-04-17 13:39:35
The
delegate function has the parameter actionSheet
itself.
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;
can be used to determine which actionSheet
it is.
As for how to distinguish, you can add a tag when creating the actionSheet; secondly, you can also save the actionSheet and determine if (actionSheet == self.actionSheet1)
like this in the delegate function. However, actionSheet may retain the delegate. It is better to use weak references when saving...
ringa_lee2017-04-17 13:39:35
You can use Block to write a synchronous ActionSheet, and the code looks intuitive.