[英]Load UIViewController from UIView(.xib) Button Action
我已經在Interface Builder中創建了一個UIView。我有一個按鈕。我可以通過點擊UIView的Button來加載應用程序中的任何ViewController嗎? 我的UIView不在導航控制器下。
你可以這樣
YourViewController *aView = [[YourViewController alloc]
initWithNibName:@"xibName" bundle:nil];
[self presentViewController:aView animated:YES completion:nil];
您可以使用NSNotification通知ViewController呈現另一個ViewController。
此處的更多信息:
顯示ViewController:
ViewController *viewController = ...;
[self presentViewController:viewController animated:YES completion:NULL];
另一種選擇是從您的按鈕調用委托。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.