我试图为我的应用程序构建主页启动器... 类似于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