WEB开发网
开发学院手机开发iPhone 开发 iPhone屏幕旋转的例子 阅读

iPhone屏幕旋转的例子

 2010-11-05 00:53:50 来源:WEB开发网   
核心提示:{// Custom initialization}return self;}*//*// Implement loadView to create a view hierarchy programmatically, without using a nib.- (void)loadView {}*//*// Impl
{

// Custom initialization

}

return self;

}

*/

/*

// Implement loadView to create a view hierarchy programmatically, without using a nib.

- (void)loadView {

}

*/

/*

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

- (void)viewDidLoad {

[super viewDidLoad];

}

*/

// Override to allow orientations other than the default portrait orientation.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

// Return YES for supported orientations

return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);

}

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration

{

if (interfaceOrientation==UIInterfaceOrientationPortrait || interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown) {

button1.frame=CGRectMake(20, 20, 125, 125);

button2.frame=CGRectMake(175, 20, 125, 125);

button3.frame=CGRectMake(20, 168, 125, 125);

button4.frame=CGRectMake(175, 168, 125, 125);

button5.frame=CGRectMake(20, 315, 125, 125);

button6.frame=CGRectMake(175, 315, 125, 125);

}else {

button1.frame=CGRectMake(20, 20, 125, 125);

button2.frame=CGRectMake(20, 155, 125, 125);

button3.frame=CGRectMake(177, 20, 125, 125);

button4.frame=CGRectMake(177, 155, 125, 125);

button5.frame=CGRectMake(328, 20, 125, 125);

button6.frame=CGRectMake(328, 155, 125, 125);

}

}

- (void)didReceiveMemoryWarning {

// Releases the view if it doesn't have a superview.

Tags:iPhone 屏幕 旋转

编辑录入:coldstar [复制链接] [打 印]
赞助商链接