IVIS
[편집] uicontrol.m
#import "uicontrol.h"
@implementation uicontrol
@synthesize uicon;
-(id)init
{
self = [super init];
if(self != nil)
{
uicon = [[viewfile alloc] initWithFrame:CGRectMake(0,0,320,480)];
[uicon setBackgroundColor:[UIColor greenColor]];
[self.view addSubview:uicon];
}
return self;
}
-(void) willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
duration:(NSTimeInterval)duration
{
UIInterfaceOrientation toOrientation = self.interfaceOrientation;
if(toOrientation == UIInterfaceOrientationPortrait || toOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
CGRect contentRect = CGRectMake(0,0,320,480);
uicon.frame = contentRect;
contentRect = CGRectMake(-60,0,320,480);
uicon.bounds = contentRect;
}
else
{
CGRect contentRect = CGRectMake(0,0,480,320);
uicon.frame = contentRect;
contentRect = CGRectMake(-60,0,480,320);
uicon.bounds = contentRect;
}
}
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}
- (void)dealloc {
[super dealloc];
[uicon release];
}
@end