Working on iphone splash screen, I have made custom animation with the help of some images that will be on my splash screen on landscape mode and then i want when my second view loads it should show up in portrait mode, but i am unable to implementing this, here goes my code:
@interface SplashViewController : UIViewController
{
IBOutlet UIImageView *ani;
NSMutableArray *arr;
}
@property(strong,nonatomic)UIImageView *ani;
@property(strong,nonatomic)NSMutableArray *arr;
-(void)switchView;
@end
#import "SecondView.h"
@implementation SplashViewController
@synthesize ani,arr;
- (void)viewDidLoad
{
arr = [NSMutableArray arrayWithObjects:[UIImage imageNamed:@"image_1.png"],
[UIImage imageNamed:@"image_2.png"],[UIImage imageNamed:@"image_3.png"],
[UIImage imageNamed:@"image_4.png"],[UIImage imageNamed:@"image_5.png"],
[UIImage imageNamed:@"image_6.png"],[UIImage imageNamed:@"image_7.png"],
[UIImage imageNamed:@"image_8.png"],[UIImage imageNamed:@"image_9.png"],
[UIImage imageNamed:@"image_10.png"],[UIImage imageNamed:@"image_11.png"],
[UIImage imageNamed:@"image_12.png"],[UIImage imageNamed:@"image_13.png"],
[UIImage imageNamed:@"image_14.png"],[UIImage imageNamed:@"image_15.png"],
[UIImage imageNamed:@"image_16.png"],[UIImage imageNamed:@"image_17.png"],
[UIImage imageNamed:@"image_18.png"],[UIImage imageNamed:@"image_19.png"],
[UIImage imageNamed:@"image_20.png"],nil];
[ani setImage:[UIImage imageNamed:@"image_20.png"]];
ani.animationImages=arr;
ani.animationDuration=10;
// ani.animationRepeatCount=1.0;
[ani startAnimating];
[self performSelector:@selector(switchView) withObject:nil afterDelay:15.0];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)switchView
{
[ani stopAnimating];
SecondView *sec=[[SecondView alloc]init];
[self.view addSubview:sec.view];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
I took one button in second view to remove the splash view from it, so as when we click the button on second view the splash view should go off, or same can be done on did load of second view but i am unable to achieve it
-(IBAction)btn:(id)sender
{
// UIViewController
[self.view removeFromSuperview];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Note: I do not want to use the Default.png image for my flash i want this custom animation for my splash to be on landscape mode and following view's are in portrait, when i try to run this the second view comes up on the splash view but the splash view still appears on back of view .. i have only simulator to test .. can any one help me out on this??