24/7 twenty-four seven

iOS/OS X application programing topics.

UIImageViewを使って画像を回転

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (UIDeviceOrientationIsLandscape(orientation)) {
	[landscapeClockView setCenter:CGPointMake(160.0, 240.0)];
	if (orientation == UIDeviceOrientationLandscapeLeft) {
		[landscapeClockView setTransform:CGAffineTransformMakeRotation(M_PI / 2.0)];
	} else {
		[landscapeClockView setTransform:CGAffineTransformMakeRotation(M_PI / -2.0)];
	}