您的位置:首页 > 移动开发 > IOS开发

ios之旋转式移动按钮

2013-02-19 11:34 232 查看
在.m 打开

1、

shouldAutorotateToInterfaceOrientation:

(UIInterfaceOrientation)interfaceOrientation并修改
- (BOOL)shouldAutorotateToInterfaceOrientation:

(UIInterfaceOrientation)interfaceOrientation {

return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);

}

2、- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { //此方法在旋转开始之后,最后的旋转动画发生之前自动调用

if (interfaceOrientation == UIInterfaceOrientationPortrait )

{

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

{

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);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: