我有两个视图控制器,称为 DataPass 和 ViewController。我想将数据从 DataPass 传递到 ViewController。我在 ViewController 中有一个标签,在我的 ViewController 中有一个 UIButton,它将自行关闭,并且在关闭时会将数据传递给 DataPass 中的标签。
我做不到。请帮忙。这是我的代码:
视图控制器.h
@interface ViewController : UIViewController
- (IBAction)sayfaGec:(id)sender;
@property (retain, nonatomic) IBOutlet UILabel *label;
+(ViewController *)hop;
视图控制器.m
+(ViewController *)hop{
static ViewController *myInstance = nil;
if (myInstance == nil){
myInstance = [[[self class]alloc]init];
myInstance.label.text = @"test";
}
return myInstance;
}
数据通行证
- (IBAction)sayfaKapat:(id)sender;
数据通行证
- (IBAction)sayfaKapat:(id)sender {
[ViewController hop].label.text = @"ddsg";
[self dismissModalViewControllerAnimated:YES];
}