I want to go to other page after user insert correct username and correct password. How to do that ? First menu is ViewController. Second view is Utama. Username is gotten from username NSString and password is gotten from password NSString.
The correct username is "Andika" and the correct password is 1234.
Storyboard
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *appTittle;
@property (weak, nonatomic) IBOutlet UITextField *usernameTextField;
@property (weak, nonatomic) IBOutlet UITextField *passwordTextField;
- (IBAction)okPressed:(id)sender;
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (IBAction)okPressed:(id)sender {
NSString *username = [_usernameTextField text];
NSString *password = [_passwordTextField text];
if([username compare:@"andika"] && [password compare:@"1234"]) {
//????
}
}
@end
Utama.m
#import "Utama.h"
@interface Utama ()
@end
@implementation Utama
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
0 comments:
Post a Comment