![](/img/trans.png)
[英]How to control objects in another view controller? (Xcode:objective-c)
[英]Objective-C Showing a view controller on another view controller programmatically
我有一個問題。 我有一個viewController1,在其中單擊一個按鈕。 當我按下此按鈕時,我希望它在viewController1上顯示另一個視圖控制器(viewController2)(viewController2有點透明)。 我想以編程方式執行此操作。 我嘗試了這個,但是當我按下按鈕時什么也沒發生:
Notification *newView = [[Notification alloc]initWithNibName:@"Notification" bundle:nil];
[self.navigationController pushViewController:newView animated:YES];
我重命名了一些變量以使其更清晰。 感謝您的回答!
編輯:也許我還不夠清楚,我希望viewController2是viewController1的ONTOP
請嘗試以下:
Notification *newView = [[Notification alloc]initWithNibName:@"Notification" bundle:nil];
[self presentViewController:newView animated:YES completion:nil];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.