DataPass と ViewController という 2 つのビュー コントローラーがあります。DataPass から ViewController にデータを渡したいです。ViewController にラベルがあり、ViewController に UIButton があり、それ自体を却下し、却下中にデータを DataPass のラベルに渡します。
できませんでした。助けてください。これが私のコードです:
ViewController.h
@interface ViewController : UIViewController
- (IBAction)sayfaGec:(id)sender;
@property (retain, nonatomic) IBOutlet UILabel *label;
+(ViewController *)hop;
ViewController.m
+(ViewController *)hop{
static ViewController *myInstance = nil;
if (myInstance == nil){
myInstance = [[[self class]alloc]init];
myInstance.label.text = @"test";
}
return myInstance;
}
DataPass.h
- (IBAction)sayfaKapat:(id)sender;
DataPass.m
- (IBAction)sayfaKapat:(id)sender {
[ViewController hop].label.text = @"ddsg";
[self dismissModalViewControllerAnimated:YES];
}