IOS旋转布局
这个效果变成但是结果却一直这样
请问各位大神怎么解决啊?
我的是IOS SDK6.0
下边是ViewController.m代码
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize buttonUL;
@synthesize buttonUR;
@synthesize buttonL;
@synthesize buttonR;
@synthesize buttonLL;
@synthesize buttonLR;
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
//if(UIInterfaceOrientationIsPortrait(toInterfaceOrientation))
if(interfaceOrientation == UIInterfaceOrientationPortrait ||interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
buttonUL.frame = CGRectMake(20, 20, 125, 125);
buttonUR.frame = CGRectMake(175, 20, 125, 125);
buttonL.frame = CGRectMake(20, 168, 125, 125);
buttonR.frame = CGRectMake(175, 168, 125, 125);
buttonLL.frame = CGRectMake(20, 316, 125, 125);
buttonLR.frame = CGRectMake(175, 316, 125, 125);
}
else
{
buttonUL.frame = CGRectMake(20, 20, 125, 125);
buttonUR.frame = CGRectMake(20, 155, 125, 125);
buttonL.frame = CGRectMake(177, 20, 125, 125);
buttonR.frame = CGRectMake(177, 155, 125, 125);
buttonLL.frame = CGRectMake(328, 20, 125, 125);
buttonLR.frame = CGRectMake(328, 155, 125, 125);
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
//struct CGPoint {
// CGFloat x;
// CGFloat y;
//};
//typedef struct CGPoint CGPoint;
//struct CGSize {
// CGFloat width;
// CGFloat height;
//};
//typedef struct CGSize CGSize;
- (void)viewDidLoad
{
self.buttonUL = nil;
self.buttonUR = nil;
self.buttonL = nil;
self.buttonR = nil;
self.buttonLL = nil;
self.buttonLR = nil;
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end