idLoad];
self.view.backgroundColor = [UIColor grayColor];
UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(150, 150, 20,30)];
btn.backgroundColor = [UIColor whiteColor];
[self.view addSubview:btn];
self.btn = btn;
[btn setTitle:@"one" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(jump:) forControlEvents:UIControlEventTouchUpInside];
self.textfield = [[UITextField alloc]initWithFrame:CGRectMake(50, 50, 200, 30)];
self.textfield.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:self.textfield];
}
//对应上面的第二步 ->调用
-(void)jump:(UIButton *)btn {
if (self.myBlock) {
self.myBlock(self.textfield.text);
}
[self.navigationController popToRootViewControllerAnimated:YES];
}
@end
|