#import <UIKit/UIKit.h>
@class SplashScreenViewController;
@interface ExampleAppDelegate : NSObject <UIApplicationDelegate>
{
UIWindow *window;
SplashScreenViewController *splashScreen;
BOOL shouldLoadSplashScreen;
UIImageView *imageView;
id lastViewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) id lastViewController;
-(void)setCurrentView:(UIViewController*)viewControllerObj;
@end
#import "ExampleAppDelegate.h"
#import "SplashScreenViewController.h"
#import "LoginViewController.h"
@implementation ExampleAppDelegate
@synthesize window;
@synthesize lastViewController;
-(void)setCurrentView:(UIViewController*)currentViewControllerObj
{
[[(UIViewController*)self.lastViewController view] removeFromSuperview];
self.lastViewController = currentViewControllerObj;
[self.window addSubview:currentViewControllerObj.view];
}
-(void)loadMenuScreen
{
[imageView removeFromSuperview];
LoginViewController *menuViewController = [[LoginViewController alloc] init];
[self.window addSubview:menuViewController.view];
self.lastViewController = menuViewController;
}
-(void)loadSplashScreen
{
imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 768, 1024)];
[imageView setImage:[UIImage imageNamed:@"SplashScreen.png"]];
[self.window addSubview:imageView];
[imageView release];
[self performSelector:@selector(loadMenuScreen) withObject:nil afterDelay:3.0];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[self loadSplashScreen];
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
shouldLoadSplashScreen = YES;
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
}
- (void)dealloc
{
[window release];
[super dealloc];
}
@end
#import <UIKit/UIKit.h>
@interface SplashScreenViewController : UIViewController
{
}
@end
#import "SplashScreenViewController.h"
@implementation SplashScreenViewController
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation ==UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight ));
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (void)dealloc
{
[super dealloc];
}
@end
#import <UIKit/UIKit.h>
@interface LoginViewController : UIViewController <UITextFieldDelegate,UIAlertViewDelegate>
{
UITextField *IDtextFld;
UITextField *PaswordtextFld;
}
@end
#import "LoginViewController.h"
#import "OutletDetailsViewController.h"
#import "ExampleAppDelegate.h"
@implementation LoginViewController
- (void)viewDidLoad
{
[super viewDidLoad];
IDtextFld = [[UITextField alloc]initWithFrame:CGRectMake(420, 348, 420, 50)];
[IDtextFld setDelegate:self];
[IDtextFld setBorderStyle:UITextBorderStyleLine];
[IDtextFld setBackgroundColor:[UIColor clearColor]];
[self.view addSubview:IDtextFld];
[IDtextFld release];
PaswordtextFld= [[UITextField alloc]initWithFrame:CGRectMake(420, 432, 423, 52)];
[PaswordtextFld setDelegate:self];
[PaswordtextFld setBorderStyle:UITextBorderStyleLine];
[self.view addSubview:PaswordtextFld];
[PaswordtextFld release];
UIButton *SubmitButton = [UIButton buttonWithType:UIButtonTypeCustom];
[SubmitButton setImage:[UIImage imageNamed:@"LgnSubmitBtn.png"] forState:UIControlStateNormal];
[SubmitButton setFrame:CGRectMake(455, 547, 215, 63)];
[SubmitButton addTarget:self action:@selector(SubmitButton:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:SubmitButton];
}
-(void)SubmitButton:(id)sender
{
NSString *Id = IDtextFld.text ;
NSLog(@"ID is ==>>%@",Id);
NSString *pwd = PaswordtextFld.text ;
NSLog(@"Password ==>>%@",pwd);
OutletDetailsViewController *odvObject = [[OutletDetailsViewController alloc] init];
ExampleAppDelegate *delegate = (ExampleAppDelegate*)[[UIApplication sharedApplication]delegate];
[delegate setCurrentView:odvObject];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation ==UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight ));
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (void)dealloc
{
[super dealloc];
}
No comments:
Post a Comment