Tuesday, August 6, 2013

iOS Login Apllication

Add following code in .h file


#import <UIKit/UIKit.h>


@interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
{
    

    IBOutlet UITextField *txtname;
    
    IBOutlet UITextField *txtpassword;
    
}

@property (nonatomic, retain) IBOutlet UITextField *txtname;
@property (nonatomic, retain) IBOutlet UITextField *txtpassword;

-(IBAction) mylogin;

-(IBAction) makeKeyBoardGoAway;

@end




Add following code in .m file

- (IBAction) mylogin
{
    
    if ([txtname.text isEqualToString:duName]  && [txtpassword.text isEqualToString:dpassword])
    {
        
        UIAlertView *alert = [[UIAlertView allocinitWithTitle:@"Suucessfull Logi...."
                                                        message:@"Welcome.!"
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitlesnil];
        [alert show];
                            
       }
    
    else{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Login Fail...."
                                                        message:@"Username OR Password Incorrect.!"
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles: nil];
        [alert show];
                
    
    }

}


-(IBAction) makeKeyBoardGoAway{
    
    [txtpassword resignFirstResponder];
}


Aslo want create UI and match the components with File Owner......

No comments:

Post a Comment