Reputation: 8243
I am trying to change the height of UIPageControl
how I can achieve that?
Upvotes: 12
Views: 20421
Reputation: 777
For swift 4.2:
pageControl.frame = CGRect(x: desired x, y: desired y, width: desired width, height: desired height);
Upvotes: 0
Reputation: 1
if you using interface builder, you can add new constrants for your UIPageControl.Like enter image description here enter image description here
i add a beautiful background color to make you see clearly.
Upvotes: -1
Reputation: 21
I had the same issue, but wanted to solve it in storyboard. Just drop a new View to your windows main view. Then drag the UIPageControl item to the new View. Now you can adjust the height of the new view as desired. The contained UIPageControl is clipped accordingly. Most properly you have to adjust the position of the UIPageControl inside the new view to get a proper display. Don't forget to set "Clip Subviews" for the new view.
Upvotes: 2
Reputation: 3519
This works for me, a little different code. It updates the view's frame property of your page control. I put this in the viewDidLoad method of my PageViewController.m file
self.pageViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 100);
Upvotes: 0
Reputation: 1775
This is how you do that
Change the width to something strange, 153
Now open the xib as source.
Find 153
Nearby you should see number 36. Change that to the height you want.
Tada...... :)
Upvotes: 3
Reputation: 826
have you done tried like this?
UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(self.frame.size.width/2, self.frame.size.height -20, (self.frame.size.width/nimages)/2, 20)];
pageControl.numberOfPages=nimages;
[pageControl setNeedsLayout];
[self addSubview:pageControl];
Upvotes: 0
Reputation: 15147
Agree With Mike
You can change your UIPageControl height using its frame..
ex
pgControl.frame = CGRectMake(X , Y , Width , Height that you want);
Upvotes: 3
Reputation: 45598
Not using interface builder, but you can specify a new frame in code:
pageControl.frame = CGRectMake(x, y, width, height);
Upvotes: 9