0

PushViewController 用于单击按钮

这是我的代码:

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];
}

我只有 modalViewController 的代码。请帮忙!谢谢:)

4

1 回答 1

0

代替

[self presentModalViewController:view animated:YES];

你应该使用

[self.navigationController pushViewController:view animated:YES];

但是,但是,但你也应该有 NavigationController,例如

AppDelegate.m ......

StaffLoginViewController *vc = [[StaffLoginViewController alloc] init];
self.navController = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];

…………

于 2012-09-21T21:18:02.580 回答