Created
November 2, 2019 22:10
-
-
Save troZee/0bbaf1e913a2e2d5c2a68381d44507ac to your computer and use it in GitHub Desktop.
Add UIPageControl dynamically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIPageControl *pageIndicatorView = [[UIPageControl alloc] init]; | |
pageIndicatorView.translatesAutoresizingMaskIntoConstraints = NO; | |
NSLayoutConstraint *bottomConstraint = [pageIndicatorView.bottomAnchor constraintEqualToAnchor: self.view.bottomAnchor constant:0]; | |
NSLayoutConstraint *leadingConstraint = [pageIndicatorView.leadingAnchor constraintEqualToAnchor: self.view.leadingAnchor constant:0]; | |
NSLayoutConstraint *trailingConstraint = [pageIndicatorView.trailingAnchor constraintEqualToAnchor: self.view.trailingAnchor constant:0]; | |
[self.view addConstraints:@[bottomConstraint,leadingConstraint,trailingConstraint]]; | |
[self.view layoutIfNeeded]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment