简体   繁体   中英

(iphone) difference between modal view and UIAlertView?

I wanted to present a semi-transparent modal view.
From many other stackoverflow posts, (eg Transparent Modal View on Navigation Controller )
It seems common approach to this is

Create a view,
Add the view to some superview with animation,

instead of using pushModalViewController.

On second thought, I realize there is UIAlertView,
and it seems to satisfy the requirement (semi-transparent modal view).
Since UIAlertView is a view(you can make the view transparent),
and it is modal(prevents user from doing anything else) by nature.

I haven't looked at UIAlertView closely but why do people bother with creating own view and animation.

Is there a limitation of UIAlertView that forces many people to avoid it for this purpose?

Thank you

I think it is because you would be forced to delete and customize the items that are present on the UIAlertView and you can't know for sure how the memory and other elements may react to that. In the end it is finally easier and more secure just to do a new modalView with the elements you have and not mess around with UIAlertView, plus if you want to use the UIAlertView way you would have to do everything programmatically while there are ways to configure the modalView on IB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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