我試圖爲我的應用程序構建主頁啓動器... 類似於Three20中的一個。如何爲我的iOS應用程序構建啓動器?
我不想推倒重來,但像Three20解決方案是不是我在尋找:他們沒有更新到最新的iOS系統或設備(視網膜,ARC, iOS5/6),他們做的比我需要的要多得多(我基本上需要一組帶有旋轉設備旋轉標籤的按鈕)。
現在我想建立一個2×3格按鈕上裝置轉動而轉動,但代碼看起來很糟糕,我鋼需要添加iPhone5的支持...
- (void) updateLayoutForNewOrientation: (UIInterfaceOrientation) orientation {
if (UIInterfaceOrientationIsPortrait(orientation)) {
button1.frame = CGRectMake(20, 59, 130, 80);
button2.frame = CGRectMake(170, 59, 130, 80);
button3.frame = CGRectMake(20, 176, 130, 80);
button4.frame = CGRectMake(170, 176, 130, 80);
button5.frame = CGRectMake(20, 293, 130, 80);
button6.frame = CGRectMake(170, 293, 130, 80);
label1.frame = CGRectMake(20, 147, 130, 21);
label2.frame = CGRectMake(170, 147, 130, 21);
label3.frame = CGRectMake(20, 264, 130, 21);
label4.frame = CGRectMake(170, 264, 130, 21);
label5.frame = CGRectMake(20, 381, 130, 21);
label6.frame = CGRectMake(170, 381, 130, 21);
} else {
button1.frame = CGRectMake(20, 59, 130, 60);
button2.frame = CGRectMake(177, 59, 130, 60);
button3.frame = CGRectMake(328, 59, 130, 60);
button4.frame = CGRectMake(20, 155, 130, 60);
button5.frame = CGRectMake(177, 155, 130, 60);
button6.frame = CGRectMake(328, 155, 130, 60);
label1.frame = CGRectMake(20, 127, 130, 21);
label2.frame = CGRectMake(177, 127, 130, 21);
label3.frame = CGRectMake(328, 127, 130, 21);
label4.frame = CGRectMake(20, 223, 130, 21);
label5.frame = CGRectMake(177, 223, 130, 21);
label6.frame = CGRectMake(328, 223, 130, 21);
}
}
就是「地方東西,旋轉它「的方法來建立這種組件?有其他選擇嗎?
決定一個按鈕的最小尺寸,計算有多少人你可以適應可用的矩形,把它分成一個網格,並做一些佈局。 –
如果您僅針對iOS 6,請查看[UICollectionView](https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UICollectionView_class/Reference/Reference.html)... – Macmade
謝謝,我正在研究它,但我更喜歡至少瞄準iOS 5. – Napolux