swift - iOS ActionSheet Delegate 冲突的问题
阿神
阿神 2017-04-17 13:37:35
0
2
908

在我的App中有很多地方用到了ActionSheet,最近发布了一个版本,由于测试忘记测相机了,导致上线后发现一个bug,相机的ActionSheet占据了第一和第一的位置,结果当别的地方点击actionsheet前两个的时候都会跳转到相机或者是相册,请问大家怎么解决这个问题呢?

阿神
阿神

闭关修行中......

reply all(2)
大家讲道理

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...

左手右手慢动作

You can use Block to write a synchronous ActionSheet, and the code looks intuitive.

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