FlexiblePageControl - A flexible UIPageControl like Instagram.

Overview

FlexiblePageControl

A flexible UIPageControl like Instagram.

Carthage compatible Swift 4.2.x Support

OverView

Install

Carthage

For Installing with Carthage, add it to your Cartfile.

github "shima11/FlexiblePageControl"
$ carthage update

CocoaPods

For installing with CocoaPods, add it to your Podfile.

pod "FlexiblePageControl"
$ pod update

Usage

let pageControl = FlexiblePageControl()
pageControl.numberOfPages = 10
view.addSubview(pageControl)

Customize

// color
pageControl.pageIndicatorTintColor = color1
pageControl.currentPageIndicatorTintColor = color2

// size
let config = FlexiblePageControl.Config(
    displayCount: 7,
    dotSize: 6,
    dotSpace: 4,
    smallDotSizeRatio: 0.5,
    mediumDotSizeRatio: 0.7
)

pageControl.setConfig(config)

Update page

func scrollViewDidScroll(_ scrollView: UIScrollView) {
    pageControl.setProgress(contentOffsetX: scrollView.contentOffset.x, pageWidth: scrollView.bounds.width)
}

or

pageControl.setCurrentPage(at: page)

Licence

Licence MIT

Comments
  • XCode 10.2 and Carthage

    XCode 10.2 and Carthage

    Hey. When using new XCode 10.2 with Swift 5 I was not able to install this library as a dependency, because of the value of swift version inside .swift-version file, which is 3.0. I think it would be nice to have proper version inside this file. Thank you for your work. This library is small and easy to use.

    opened by odisei369 5
  • intrinsicContentSize is not updated if the numberOfPages is changed

    intrinsicContentSize is not updated if the numberOfPages is changed

    I use it in a cell and the component width is not updated when I update the numberOfPages. The result being that the dots are not centered in the view anymore.

    An easy fix is to force the intrinsicContentSize to be updated and call https://developer.apple.com/documentation/uikit/uiview/1622457-invalidateintrinsiccontentsize

    opened by mime29 4
  • fixes ScrollViews layout.

    fixes ScrollViews layout.

    はじめまして!

    レイアウトが完了してから再度numberOfPagesを変更するような処理をすると、Viewの位置がズレるようです。こちらを修正してみました。いかがでしょうか?

    Demoで以下のようなコードを追加すると再現できます。

        override func viewDidAppear(_ animated: Bool) {
            super.viewDidAppear(animated)
            pageControl1.numberOfPages = 10
            pageControl2.numberOfPages = 10
        }
    

    scrollView.frameを変更せず、bounds.sizeを変更することで位置を変えずに大きさだけ変更するようにしました。

    ページ数を都度変えるような実装もあるかと思いますので、ご確認よろしくお願いいたします 🙇

    opened by TomoyaOnishi 3
  • Config initialiser is inaccessible

    Config initialiser is inaccessible

    Thanks for the library! The initialiser for Config structure is not available. Because it is not defined as public. 2018-06-25 11 30 04 The solution is to write like this:

        // MARK: public
    
        public struct Config {
    
            public var displayCount: Int
            public var dotSize: CGFloat
            public var dotSpace: CGFloat
            public var smallDotSizeRatio: CGFloat
            public var mediumDotSizeRatio: CGFloat
            
            public init(displayCount: Int = 7,
                        dotSize: CGFloat = 6.0,
                        dotSpace: CGFloat = 4.0,
                        smallDotSizeRatio: CGFloat = 0.5,
                        mediumDotSizeRatio: CGFloat = 0.7) {
                self.displayCount = displayCount
                self.dotSize = dotSize
                self.dotSpace = dotSpace
                self.smallDotSizeRatio = smallDotSizeRatio
                self.mediumDotSizeRatio = mediumDotSizeRatio
            }
        }
    
        // default config
    
        private var config = Config()
    

    This way you can also specify default values right in the initialiser. So users of the library will be able to override only properties, that they need to override 🙂

    opened by wow-such-amazing 3
  • Swiping twice or more creates issues

    Swiping twice or more creates issues

    Hey there, love it, just added it today. While testing I found an issue, which I thought I might mention here. While swiping before the item has stopped decelerating it seems to jump and confuse the library. Is this something you're reproducing or might it be my problem?

    glass

    (normal view below)

    glass 2

    Thanks!

    opened by s2imon 2
  • Views reusing

    Views reusing

    Hey! Thanks for the awesome lib. Do you have any plans to add views reusing? In my app I can add up to 100 photos in a roll and performance may be low because of 100 views

    opened by serejahh 2
  • Fix podspec

    Fix podspec

    add swift version to podspec

    $ pod lib lint
    
     -> FlexiblePageControl (1.0.8)
        - NOTE  | xcodebuild:  note: Using new build system
        - NOTE  | [iOS] xcodebuild:  note: Planning build
        - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    
    FlexiblePageControl passed validation.
    
    opened by weakfl 1
  • Add config to item, so we could change ratio property

    Add config to item, so we could change ratio property

    Now, there is no way to change smallDotSizeRatio or mediumDotSizeRatio, because FlexiblePageControl doesn't pass it to underlying ItemView. We also couldn't set it manually, because ItemConfig is private class inside FlexiblePageControl.

    So, I fix this problem by creating item config during update and passing it to items. It will work properly in both situation when we set config manually or initialise FlexiblePageControl with config.

    opened by odisei369 1
  • Logs should be removed

    Logs should be removed

    There are some logs indicating the size of the dots:

    None None None Normal Normal Medium Small Small Small Small

    line 270 of the FlexiblePageControl.swift file

    print(item.state)
    
    opened by mime29 1
  • Add storyboard support.

    Add storyboard support.

    I get the following error when using Storyboard.

    fatal error: init(coder:) has not been implemented: file ... /Pods/FlexiblePageControl/FlexiblePageControl/FlexiblePageControl.swift, line 98

    So, I fixed the error function as follows.

    required public init?(coder aDecoder: NSCoder) {
            //fatalError("init(coder:) has not been implemented")
            super.init(coder: aDecoder)
    
            setup()
            updateViewSize()
    }
    

    This works well on the Storyboard. Could you put this code in it?

    opened by HyunjoonKo 1
  • displayCount is wrong if numberOfPages is changed

    displayCount is wrong if numberOfPages is changed

    Example:

    Set numberOfPages to 1, displayCount will be set to 1:

    displayCount = min(displayCount, numberOfPages)
    

    Now set numberOfPages to 2, displayCount will remain 1:

    displayCount = min(displayCount, numberOfPages)
    

    @shima11 you should probably use a separate private var for all calculations related to the displayCount value.

    opened by weakfl 0
  • Infinite Scrolling on FlexiblePageControl

    Infinite Scrolling on FlexiblePageControl

    Hi development team, how can I achieve infinite scroll on FlexiblePageControl? Everything works just fine but I couldn't find the way the make it become infinite scroll, It might be disappear or all the dot become same in size when the index reset. I use FlexiblePageControl along with FSPagerView. Thank for any helping !

    opened by bacsonvv 0
  • is it possible to show stationary number of  dots as default?

    is it possible to show stationary number of dots as default?

    hello, thanks for the amazing PageControl first,

    I would like to ask,

    when numberOfPages greater than displayCount

    the default dots only display for 3 dots, others are hidden/clear color

    is it possible to set always 5 dots?

    it my config below

    static let pageControlConfig = FlexiblePageControl.Config( displayCount: 5, dotSize: 6, dotSpace: 4, smallDotSizeRatio: 0.5, mediumDotSizeRatio: 0.7 )

    opened by hungwei0331 3
  • Make FlexiblePageControl properties customizable via UIAppearance

    Make FlexiblePageControl properties customizable via UIAppearance

    The proposed changes allow FlexiblePageControl to be customizable via UIAppearance, for instance:

    let config = FlexiblePageControl.Config(
    	displayCount: 5,
    	dotSize: 6,
    	dotSpace: 4,
    	smallDotSizeRatio: 0.5,
    	mediumDotSizeRatio: 0.7
    )
    FlexiblePageControl.appearance().pageIndicatorTintColor = UIColor.systemGray
    FlexiblePageControl.appearance().currentPageIndicatorTintColor = UIColor.systemBlue
    FlexiblePageControl.appearance().setConfig(config)
    
    • Add @objc dynamic to setConfig(), pageIndicatorTintColor, currentPageIndicatorTintColor, animateDuration
    • Make Config class and inherit from NSObject.
    opened by bhr 1
  • ViewWillAppear decentralising dots

    ViewWillAppear decentralising dots

    When load first time ( Storyboard ) works ok. But when open presenting view controller and close, call it again, to reload content ( number of subviews can change, content is dynamic ), all dots was not centralising anymore, debugging first time and second time, can see this. Try to centralising with .center = CGPoint(params correct here), first time works, second, align all to left. Not working.

    opened by loverde-co 0
Releases(1.0.5)
Owner
shima
iOS Engineer
shima
● ○ ○ ○ A nice, animated UIPageControl alternative.

Page Control Installation Usage Example import UIKit import PageControl class ViewController: UIViewController, UIScrollViewDelegate { @IBOu

Kasper Lahti 113 Sep 1, 2022
This is a selection of custom page controls to replace UIPageControl

PageControls This is a selection of custom page controls to replace UIPageControl, inspired by a dribbble found here. The appearance (color, size, # o

Kyle Zaragoza 1k Jan 2, 2023
💥 Beautiful, animated and highly customizable UIPageControl alternative for iOS.

PageControl Requirements iOS 9.0+ Xcode 7.0+ Installation CocoaPods: Add folowing line to Podfile and run 'pod instal'. pod 'Sevruk-PageControl' Or j

Sevruk Development 30 May 2, 2022
This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl

NSPageControl This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl. Demo ##Installation NSPageControl supports multiple

Kohei Tabata 13 Jan 19, 2022
Instagram clone, the main focus of the app is the seamless swipe between views that we see on instagram

InstaSwipe Instagram clone, the main focus of the app is the seamless swipe betw

Stavros Pachoundakis 1 Dec 15, 2022
CHIPageControl is a set of cool animated page controls to replace boring UIPageControl.

CHIPageControl is a set of cool animated page controls to replace boring UIPageControl. We were inspired by Jardson Almeida dribbble sh

Chili Labs 3.1k Jan 4, 2023
● ○ ○ ○ A nice, animated UIPageControl alternative.

Page Control Installation Usage Example import UIKit import PageControl class ViewController: UIViewController, UIScrollViewDelegate { @IBOu

Kasper Lahti 113 Sep 1, 2022
This is a selection of custom page controls to replace UIPageControl

PageControls This is a selection of custom page controls to replace UIPageControl, inspired by a dribbble found here. The appearance (color, size, # o

Kyle Zaragoza 1k Jan 2, 2023
💥 Beautiful, animated and highly customizable UIPageControl alternative for iOS.

PageControl Requirements iOS 9.0+ Xcode 7.0+ Installation CocoaPods: Add folowing line to Podfile and run 'pod instal'. pod 'Sevruk-PageControl' Or j

Sevruk Development 30 May 2, 2022
This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl

NSPageControl This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl. Demo ##Installation NSPageControl supports multiple

Kohei Tabata 13 Jan 19, 2022
🎨 Gradient animation effect like Instagram

Pastel ?? Gradient animation effect like Instagram Example override func viewDidLoad() { super.viewDidLoad() let pastelView = PastelView(fram

Cruz 3.4k Jan 1, 2023
Instagram-like photo browser and a camera feature with a few line of code in Swift.

Fusuma is a Swift library that provides an Instagram-like photo browser with a camera feature using only a few lines of code.

Yuta Akizuki 2.4k Dec 31, 2022
Image filtering UI library like Instagram.

Sharaku Usage How to present SHViewController let imageToBeFiltered = UIImage(named: "targetImage") let vc = SHViewController(image: imageToBeFiltered

Makoto Mori 1.5k Dec 20, 2022
📸 Instagram-like image picker & filters for iOS

YPImagePicker YPImagePicker is an instagram-like photo/video picker for iOS written in pure Swift. It is feature-rich and highly customizable to match

Yummypets 4k Dec 27, 2022
An easy way to add mentions to uitextview like Facebook and Instagram

OEMentions An easy way to add mentions to uitextview like Facebook and Instagram. It also include a tableview to show the users list to choose from. T

Omar Alessa 48 Oct 23, 2022
A horizontal scroll dial like Instagram.

HorizontalDial Preview Requirements iOS 8.0+ Swift 5 Storyboard support Installation CocoaPods use_frameworks! pod "HorizontalDial" Manually To instal

Lee Sun-Hyoup 210 Nov 22, 2022
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)

Unfortunately, life gets in the way sometimes and I won't be able to maintain this library any longer and upgrade this library to where it needs to be

null 5.2k Dec 31, 2022
Instagram-like photo browser and a camera feature with a few line of code in Swift.

NOTE: This project is no longer maintained. We highly recommend YPImagePicker. Fusuma Fusuma is a Swift library that provides an Instagram-like photo

Yuta Akizuki 2.4k Dec 31, 2022
Snapchat / Instagram Stories like progress indicator

SegmentedProgressBar A simple little control that animates segments like Snapchat or Instagram Stories. Requirements iOS 8.0+ Xcode 8 Installation Dra

Dylan Marriott 442 Dec 25, 2022
An instagram-like image editor that can apply preset filters passed to it and customized editings to a binded image.

CZImageEditor CZImageEditor is an instagram-like image editor with clean and intuitive UI. It is pure swift and can apply preset filters and customize

null 8 Dec 16, 2022