开发者

Xcode 4 UIPage Control: How to change the height of the Page Control?

开发者 https://www.devze.com 2023-04-05 02:04 出处:网络
I wanted to make the UIPageControl area (dots) shorter. I tried to change its height smaller in the Size Inspector but its height value is greyed ou开发者_JS百科t and it cant be changed. It\'s value b

I wanted to make the UIPageControl area (dots) shorter. I tried to change its height smaller in the Size Inspector but its height value is greyed ou开发者_JS百科t and it cant be changed. It's value by default is 36. Is there any way of decreasing this value programmatically? I know that you can make the page controllers background see through, but I don't want that. I wanted to make the background slightly transparent, I did that, but I want the Height of the background to be smaller. If someone can help me out then that would be awesome. THANKS!


This is how you change the height of a UIPageControl. In the PageViewController.m in the viewDidLoad method, put the following code:

self.pageViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 100);

This updates the frame property of the view of your UIPageControl.


Try this:

CGRect frame = pageControl.frame;
frame.size.height = 10.0; // or whatever you want
pageControl.frame = frame;

This, of course, goes in your code, presumably in the controller that has access to your pageControl IBOutlet.

0

精彩评论

暂无评论...
验证码 换一张
取 消