How to put an image on UIActionSheet?

2019-03-07 04:19发布

问题:

How to put image on UIActionSheet on right position of text. Like given in apple music player.

Note: Don't answer with custom view, if it is possible in UIActionSheet, Kindly let us know.

回答1:

Don't answer with custom view

Then you are effectively forbidding anyone to answer, because that is what you do.

First of all, there is no such thing as UIActionSheet. It was deprecated four years ago. Today we use UIAlertController.

UIAlertController is nothing but a prepackaged presented view controller. It does nothing that you could not do for yourself. It is also deliberately very simple and limited. So if you want to do something that goes beyond the limits what UIAlertController gives you, then you simply create a custom presented view controller. Adding the animation and "dimming view" to make it look like a standard action sheet is easy; just make a custom transition animation.

That is what the interface shown in your screen shot is. It is not a UIActionSheet. It is not a UIAlertController. It's just a custom presented view controller that Apple has created. And so can you.