アットウィキロゴ

UIDevice

// OSのバージョン取得
NSString *osVer = [UIDevice currentDevice].systemVersion; 
 
// デバイスの向き->0 : 不明、1 :ホームボタン下、2 : ホームボタン上、3 : ホームボタン右、4 : ホームボタン左
int direction = self.interfaceOrientation;
 
// デバイスの向き変更時イベント
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	// ステータスバー表示位置変更
	[[UIApplication sharedApplication] setStatusBarOrientation:interfaceOrientation animated:NO];
 
	return YES;// 向き変更を許可
	// UIInterfaceOrientationPortrait		// ホームボタン下
    	// UIInterfaceOrientationLandscapeLeft		// ホームボタン左
    	// UIInterfaceOrientationLandscapeRight		// ホームボタン右
    	// UIInterfaceOrientationPortraitUpsideDown	// ホームボタン上
}
 
// 回転開始前イベント
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
                               duration:(NSTimeInterval)duration {
}
 
// 回転完了後イベント
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
}
 

タグ:

+ タグ編集
  • タグ:
最終更新:2012年09月25日 13:57
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。