有人能给出一个示例,说明如何将Monotouch应用程序的视图从竖屏旋转到横屏,反之亦然吗?
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
return true;
}
提醒大家一下,现在它位于视图变换对象上:
View.Transform.Rotate(3.14159f * 0.5f);
对于像我这样的所有dotnet人员,不想使用任何CGAffineTransform的东西,认为它会破坏其他东西,只需尝试一下。对我的实例非常有效。旋转了NavigationController.View,里面的所有内容都是完美的。
这是你可以尝试的。
如果您想在触摸视图时更改视图的方向,请按照以下步骤进行:
在视图内实现touchesBegan方法。
在touchesBegan方法中检查当前设备方向,[[UIDevice currentDevice] orientation];
如果要更改方向,则使用CGAffineTransformation方法在视图上,如viewRef.transform = CGAffineTransformMakeRotation(angle);