Вот грубая реализация jQuery идеи tvanfosson:
$(document).ready(function(){
idleTime = 0;
//Increment the idle time counter every second.
var idleInterval = setInterval(timerIncrement, 1000);
function timerIncrement()
{
idleTime++;
if (idleTime > 2)
{
doPreload();
}
}
//Zero the idle timer on mouse movement.
$(this).mousemove(function(e){
idleTime = 0;
});
function doPreload()
{
//Preload images, etc.
}
})
у меня это работает
CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_2);
self.view.transform = transform;
// Repositions and resizes the view.
CGRect contentRect = CGRectMake(0,0, 480, 320);
self.view.bounds = contentRect;
I had success with that:
CATransform3D rotationTransform = CATransform3DIdentity;
[view.layer removeAllAnimations];
rotationTransform = CATransform3DRotate(rotationTransform, angle, 0.0, 0.0, 1);
view.layer.transform = rotationTransform;
Не уверен, что это частный API, поэтому вы можете не захотеть его использовать, но если вы хотите принудительно изменить ориентацию, не наклоняя устройство, вы можете попробовать позвонить:
[[UIDevice currentDevice] performSelector:@selector(setOrientation:)
withObject:(id)UIInterfaceOrientationLandscapeLeft];
Я не проверял, работает ли он на 3.1.2. хотя я знаю, что он работает на 3.0.