我們有頁控制寬度100,但隨後也被怪異的方式去頁面管理幅度問題
請幫忙如何處理它的寬度
編輯:
[pageControl setFrame:CGRectMake(100,258,100,10)];
這是我如何設置frame.I交叉檢查沒有其他地方我正在改變框架。 頁數是動態 整體設置我有編碼做了不Interface Builder中
我們有頁控制寬度100,但隨後也被怪異的方式去頁面管理幅度問題
請幫忙如何處理它的寬度
編輯:
[pageControl setFrame:CGRectMake(100,258,100,10)];
這是我如何設置frame.I交叉檢查沒有其他地方我正在改變框架。 頁數是動態 整體設置我有編碼做了不Interface Builder中
嘗試這一行viewDidLoad:
方法還可以指派頁面,這個控制後寫這樣的代碼......
yourPageControl.autoresizingMask = UIViewAutoresizingFlexibleWidth;
,也爲的PageControl對準中心使用波紋線...
yourPageControl.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
你也可以從Interface Builder中
爲此設置UPDATE:
//use this code instead of your for init UIPageControl
pageControl = [[UIPageControl alloc] init];
pageControl.frame = CGRectMake(100,258,100,10);
pageControl.numberOfPages = 2;//set here pages which you want..
pageControl.currentPage = 0;
pageControl.autoresizingMask = UIViewAutoresizingNone;
[self.view addSubview:pageControl];
我希望這對你有幫助...
我太晚了,但仍然, 嘗試下面的代碼,這將限制點包含到頁面的邊界控制
pageControl = [[UIPageControl alloc] init];
pageControl.frame = CGRectMake(100,258,100,10);
pageControl.numberOfPages = 100;
pageControl.currentPage = 0;
pageControl.clipsToBounds = YES;
[self.view addSubview:pageControl];
在這裏你可以看到邊界內的點。
沒有問題..我會給嘗試你的代碼 – Sakshi 2014-11-06 12:06:38
只需將屬性「clipsToBounds」設置爲true即可。
你確定它的寬度是100而不是numberOfPages? – danh 2013-04-10 04:46:14
Sakshi請詳細解釋... – IronManGill 2013-04-10 04:50:54
我認爲它沒有。的頁面是100. – 2013-04-10 04:58:28