3

I am struggling the last couple of days to figure out if these alerts are part of UIKit or just a private custom view. I don't even know how they properly called. The UI team have asked for an alert that looks like the one appears in Apple's News and Podcast apps. See screenshots below.

enter image description here enter image description here

rmaddy
  • 314,917
  • 42
  • 532
  • 579
OutOfBoundsException
  • 756
  • 1
  • 11
  • 26

2 Answers2

3

Apple's code to perform this is not part of UIKit. It will need to be implemented by you! I made a framework to do just this on GitHub called AOModalStatusView (https://github.com/alecdoconnor/AOModalStatusView).

The easiest way to do this would be with a custom view presented modally and with the presentation style set to "over current context" so that what is behind the view shows through. Inside the view create a square that is centered on the view. Give it rounded corners and a specific width and height. In order to get the blurred background you should use Apple's "Visual Effects View with Blur" or "Visual Effects View with Blur and Vibrancy." (https://shrikar.com/ios-development-tutorial-visual-blur-with-uivisualeffectview/)

In the view controller for this view, set a timer shortly in viewDidAppear(..) that will run dismiss(animated: true, completion: nil)

Alec O
  • 1,697
  • 1
  • 18
  • 31
  • Thank you. I will give it a try – OutOfBoundsException Sep 29 '17 at 14:17
  • @OutOfBoundsException I don't typically cross-post personal material on SO, but your question inspired me to write a framework for these modal status views. You can find it on GitHub at https://github.com/alecdoconnor/AOModalStatusView with an example of it at https://github.com/alecdoconnor/PuppyParadise Tutorial will be coming soon too, will update then. – Alec O Oct 14 '17 at 17:33
2

You can use my own StatusAlert framework written in Swift. It gives you ability to show Apple system-like alert as well as present the same alert without an image, title or message anywhere in UIView.

It is available via Cocoapods and Carthage and supports iPhone X, Safe Areas layout, iPads and allows some customizations.

StatusAlertExample application screenshow

LowKostKustomz
  • 424
  • 4
  • 8