0
我想創建一個具有透明背景的模式視圖控制器,但是當我嘗試將背景的alpha設置爲0.5時,它只是將背後的視圖變爲完全黑色。這是因爲在轉換後,背景視圖將被刪除。具有透明背景的Objective-C模態視圖控制器
self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
[self setModalPresentationStyle:UIModalPresentationFullScreen];
[self setDefinesPresentationContext:YES];
然後呈現視圖控制器代碼
SecondViewController *alertView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self presentViewController:alertView animated:YES completion:nil];
請看鏈接 image/linke.gif
可能的[iOS - 半透明模態視圖控制器]的副本(http://stackoverflow.com/questions/18902059/ios-semi-transparent-modal-view-controller) –
究竟是@JamesP .. – vaibhav