In this article, we will discuss the following new changes to UIPageControl in iOS 14:

  • Background style
  • Custom indicator image
  • Custom indicator image at a specific index
  • Infinite pages (new scrubbing behavior)

Background Style

We have a new styling option for our UIPageControl called BackgroundStyle. This is an enum with three values:

@available(iOS 14.0, *)
	 public enum BackgroundStyle : Int {
	/// The default background style that adapts based on the current interaction state.
	 case automatic = 0
	 /// The background style that shows a full background regardless of the interaction
	 case prominent = 1
	  /// The background style that shows a minimal background regardless of the interaction
	 case minimal = 2
	 }

The usage is quite simple. By default, it is minimal:

pageControl.backgroundStyle = .prominent

Note: When an interaction state is _continuous_, the background style changes automatically if you set _backgroundStyle_ to _automatic_. I discuss interaction APIs later in this article.

#ios #xcode #swift #mobile

Take a Look at iOS 14’s New UIPageControl
60.95 GEEK