uipagecontrol

How can i change the page on clicking the dots of UIPageControl

穿精又带淫゛_ 提交于 2019-11-29 04:36:43
问题 Here I have a pagecontrol which works good but on clicking on dot it doesn't change the page so please help in the function of changepage: - (void)viewDidLoad { scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 420)]; scrollView.delegate = self; [self.scrollView setBackgroundColor:[UIColor whiteColor]]; [scrollView setCanCancelContentTouches:NO]; scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite; scrollView.clipsToBounds = YES; scrollView.scrollEnabled = YES;

Page count of UICollectionView with paging in iOS

拈花ヽ惹草 提交于 2019-11-29 04:12:23
Consider a UICollectionView with flow layout and paging enabled (by setting pagingEnabled to YES ). What would be the simplest way of obtaining the total number of pages? And where would be the most appropriate place to update the total number of pages (given that it might change if items are added/deleted, the size of the collection view changes or the layout changes)? The right answer should be: If the UICollectionView scrolls horizontally: int pages = ceil(self.collectionView.contentSize.width / self.collectionView.frame.size.width); If it scrolls vertically: int pages = ceil(self

Custom UIPageControl with dot images

↘锁芯ラ 提交于 2019-11-29 02:40:39
When I needed to custom my UIPageControl I used this and this solution. Slightly modifying it for the new version of swift we have : class myPageControl: UIPageControl { var activeImage: UIImage! var inactiveImage: UIImage! required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) activeImage = UIImage(named: "active.png")! inactiveImage = UIImage(named: "inactive.png")! } func updateDots() { for i in 0 ..< self.subviews.count { let dot : UIImageView = imageViewForSubview(self.subviews[i]) if (i == self.currentPage) { dot.image = activeImage } else { dot.image = inactiveImage } } }

Add border for dots in UIPageControl

廉价感情. 提交于 2019-11-29 01:27:04
I want to add border color for dots in UIPageControl. Here is the small picture of it: I am able to put second dot by configuring it from XCode but I cannot make the first and third circles' inside empty. Is there a simple way to achieve that? Thanks :) That is not possible with the current properties available for UIPageControl . But you can do by integrating any third party page control which mimic the functionality of iOS UIPageControl . Other answer has applied a patch. I highly disagreed with that solution. Edited- Swift 3 & 4 extension to achieve the same result- extension UIPageControl

UICollectionView: current index path for page control

本秂侑毒 提交于 2019-11-28 22:22:25
问题 I'm using a UICollectionView with a flow layout to show a list of cells, I also have a page control to indicate current page, but there seems to be no way to get current index path, I know I can get visible cells: UICollectionView current visible cell index however there can be more than one visible cells, even if each of my cells occupies full width of the screen, if I scroll it to have two halves of two cells, then they are both visible, so is there a way to get only one current visible

Increase the size of the indicator in UIPageViewController's UIPageControl

只谈情不闲聊 提交于 2019-11-28 20:27:11
Is it possible to Increase the size of the indicator in UIPageViewController ? I have this: And my requirement is this: Scaling the page control will scale the dots, but will also scale the spacing in between them. pageControl.transform = CGAffineTransform(scaleX: 2, y: 2) If you want to keep the same spacing between dots, you'll need to transform the dots individually: pageControl.subviews.forEach { $0.transform = CGAffineTransform(scaleX: 2, y: 2) } However, if you do this in viewDidLoad , the transform has been reset by the time the view appears, so you should do this in

How to change UIPageControl dots [duplicate]

巧了我就是萌 提交于 2019-11-28 07:47:33
This question already has an answer here: How can I change the color of pagination dots of UIPageControl? 18 answers Is there a way to change page indicator dots color 10 answers I've seen apps (e.g. meebo) that have different indicators on UIPageControls instead of the default white circles. is there an easy way to do this? I've read the docs for UIPageControls and it seems that there is no methods to replace the images. You can achieve this by making the following steps: 1- Create a custom class that inherits from UIPageControl. 2- Assign this class to the required UIPageControl that you

Programmatically Linking UIPageControl to UIScrollView

你离开我真会死。 提交于 2019-11-28 03:27:18
I am making a simple slideshow view within my app. I'd like to link my UIPageControl to my UIScrollView. This shouldn't be too difficult, but I haven't been able to find a simple solution anywhere. Below is my code. HelpViewController.h #import <UIKit/UIKit.h> @interface HelpViewController : UIViewController{ } @end HelpViewController.m #import "HelpViewController.h" @interface HelpViewController () @end @implementation HelpViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if

UIPageController in conjuction with UIPageControl?

只愿长相守 提交于 2019-11-27 23:20:06
问题 I have been using UIPageController to navigate between different controllers. Now I would like to add that dots at the bottom, so user can see on which controller he is at. That is achieved via UIPageControl . Is there easy way to combine those two? 回答1: From the bottom of UIPageViewController.h (iOS6+) ~ A page indicator will be visible if both methods are implemented, transition style is 'UIPageViewControllerTransitionStyleScroll', and navigation orientation is

Page count of UICollectionView with paging in iOS

旧巷老猫 提交于 2019-11-27 22:22:04
问题 Consider a UICollectionView with flow layout and paging enabled (by setting pagingEnabled to YES ). What would be the simplest way of obtaining the total number of pages? And where would be the most appropriate place to update the total number of pages (given that it might change if items are added/deleted, the size of the collection view changes or the layout changes)? 回答1: The right answer should be: If the UICollectionView scrolls horizontally: int pages = ceil(self.collectionView