IOS-翻转注意
翻轉時,要計算好。如下是6個button的翻轉中 frame 的改變
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
??? if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {//翻轉0或180度時的情況
??????? button1.frame = CGRectMake(20, 20, 125, 125);
??????? button2.frame = CGRectMake(175, 20, 125, 125);
??????? button3.frame = CGRectMake(20, 168, 125, 125);
??????? button4.frame = CGRectMake(175, 168, 125, 125);
??????? button5.frame = CGRectMake(20, 315, 125, 125);
??????? button6.frame = CGRectMake(175, 315, 125, 125);
??? }
??? else????????????????????????????????????????????????????????? //翻轉90或270度時的情況
??? {
??????? button1.frame = CGRectMake(20, 20, 125, 125);
??????? button2.frame = CGRectMake(20, 155, 125, 125);
??????? button3.frame = CGRectMake(177, 20, 125, 125);
??????? button4.frame = CGRectMake(177, 155, 125, 125);
??????? button5.frame = CGRectMake(328, 20, 125, 125);
??????? button6.frame = CGRectMake(328, 155, 125, 125);?????? ?
??? }
}
轉載于:https://www.cnblogs.com/tx8899/archive/2012/06/05/2536352.html
總結
- 上一篇: 使用iOS手势UIGestureReco
- 下一篇: 2012黑龙江省赛J题-最小均值圈