1
我在製作登錄屏幕。我有以下故事板。 故事板視圖控制器中的透明背景
我在做的代碼是。如果設備上存儲了用戶名和密碼。比passViewController彈出。其他登錄視圖控制器彈出。這工作正常。
我的問題是,LoginViewController和PassViewController應該有一個透明的背景。我知道如何用單個xib文件做到這一點,但我想在故事板中做到這一點,以便我可以使用Login和Passviewcontroller中的segues到nextController。目前我正在使用代碼進行此操作。
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
vc.view.backgroundColor = [UIColor clearColor];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:vc animated:YES];
任何人都可以幫助我如何實現這一目標。
親切的問候。
是的,我做到了,但我得到了一個黑色的背景。 – Steaphann
好吧,我現在可以看到你正在嘗試做什麼..你需要將你的圖像設置爲你的viewControllers視圖中的背景圖像。你可以這樣做:'self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@「image name」]];' – NikosM
是的,這可以是一個解決方案。但我希望它顯示像一個alertview,這就是爲什麼我希望它是透明的 – Steaphann