gpt4 book ai didi

iphone - 将它链接到 Storyboard 中的某个 View Controller ?

转载 作者:行者123 更新时间:2023-11-29 11:13:25 26 4
gpt4 key购买 nike

我有一个 Action 需要链接到 Storyboard 中的某个 View 。我目前在下面链接到 Storyboard 的第一个 View 的代码。我如何将它链接到 Storyboard 中的某个 View Controller ?仅供引用 - 此链接来自一个不属于 Storyboard 的 xib 文件,它工作正常。谢谢

  - (IBAction)continueWithoutLoginButtonTouchHandler:(id)sender 
{

UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController* initialHelpView = [storyboard instantiateInitialViewController];

initialHelpView.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:initialHelpView animated:YES];
}

我想知道方法:instantiateViewControllerWithIdentifier: 然后识别 Storyboard中的一个 View 是否可行。

 - (IBAction)continueWithoutLoginButtonTouchHandler:(id)sender 
{

UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
// UIViewController* viewController = [storyboard instantiateInitialViewController];

UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"RotationVC"];

viewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:viewController animated:YES];
}

谢谢你的帮助

最佳答案

使用方法:instantiateViewControllerWithIdentifier: 然后识别 Storyboard中的 View 之一:

 - (IBAction)continueWithoutLoginButtonTouchHandler:(id)sender 
{

UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
// UIViewController* viewController = [storyboard instantiateInitialViewController];

UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"RotationVC"];

viewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:viewController animated:YES];
}

关于iphone - 将它链接到 Storyboard 中的某个 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10532531/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com