11
#import "FirstViewController.h"
#import "SecondViewController.h"
@interface FirstViewController ()
@end
@implementation FirstViewController
- (void)dealloc {
[_textField release];
[super dealloc];
}
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"123456");
self.navigationItem.title = @"第一界面";
self.view.backgroundColor = [UIColor redColor];
_textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 200, 40)];
_textField.borderStyle = UITextBorderStyleRoundedRect;
_textField.text = self.string;
// _textField.placeholder = @"请输入文本";
[self.view addSubview:_textField];
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(100, 200, 200, 40);
[button setTitle:@"进入下一界面" forState:UIControlStateNormal];
[button addTarget:self action:@selector(push) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
// Do any additional setup after loading the view.
}
- (void)push {
SecondViewController *secondVC = [[SecondViewController alloc] init];
secondVC.string = self.textField.text;
secondVC.color = self.view.backgroundColor;
[self.navigationController pushViewController:secondVC animated:YES];
[secondVC release];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}