我有一个包含一些文本字段的视图。我这样设置视图的方向
(void)deviceRotated:(id)sender
{
UIDeviceOrientation orientation = [[UIDevice currentDevice]orientation];
if (orientation == UIDeviceOrientationPortrait)
{
CGAffineTransform affine = CGAffineTransformMakeRotation (0.0);
[self.View setTransform:affine];
}
if (orientation == UIDeviceOrientationPortraitUpsideDown)
{
CGAffineTransform affine = CGAffineTransformMakeRotation (M_PI * 180 / 180.0f);
[self.View setTransform:affine];
}
else if (orientation == UIDeviceOrientationLandscapeLeft)
{
CGAffineTransform affine = CGAffineTransformMakeRotation (M_PI * 90 / 180.0f);
[self.View setTransform:affine];
}
else if (orientation == UIDeviceOrientationLandscapeRight)
{
CGAffineTransform affine = CGAffineTransformMakeRotation ( M_PI * 270 / 180.0f);
[self.View setTransform:affine];
}
}
我的问题是我想让该视图在键盘出现时向上移动,因为键盘隐藏了一些文本字段。我想我必须使用 CGAffineTransformMakeTranslation,但我不知道在旋转之后如何使用它。
有人可以帮我解决这个问题吗?