pageView を作成し、各ページにボタンがあります。新しいView Controllerにプッシュしているときに、変数を渡すにはどうすればよいですか。これは、intent.putExtra() を使用して Android で行いました。
iOSでの私のコードは次のとおりです。
- (IBAction)openButton:(id)sender {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
// i have tried: vc.magazine = @"Lifestyle"; but is saying property not found in ViewController
[self.navigationController pushViewController:vc animated:NO];
}
2 番目のビュー コントローラー ヘッダー ファイルの変数は次のとおりです。
@interface ViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
NSString *magazine;
}
@property (nonatomic, copy) NSString *magazine;
@end
よろしくお願いします。ご不明な点がございましたら、お問い合わせください。