PushViewController for a button click
Here's my code:
ViewController.h
import < UIKit/UIKit.h>
@interface StaffLoginViewController : UIViewController
@property (retain, nonatomic) IBOutlet UITextField *StaffUsername;
@property (retain, nonatomic) IBOutlet UITextField *StaffPassword;
- (IBAction)LoginClicked:(id)sender;
@property (nonatomic, retain) NSArray *arrayLogin;
- (IBAction)ResignKeyboardClicked:(id)sender;
@end
ViewController.m
- (IBAction)LoginClicked:(id)sender{
ViewController *view = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[self presentModalViewController:view animated:YES];
}
I only have the code for modalViewController. Please help! Thanks:)
Instead of
[self presentModalViewController:view animated:YES];
you should use
[self.navigationController pushViewController:view animated:YES];
but, but, but you should have NavigationController as well, for example
AppDelegate.m ......
StaffLoginViewController *vc = [[StaffLoginViewController alloc] init];
self.navController = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];
.......