开发者

calling presentModalViewController to show a view created programmatically

I've noticed that if I create a UIViewController-derived class programatically (without using a nib) to be displayed with a call to presentModalViewController, as the view slides in, it's actually transparent by default until the view covers the entire screen, after which point the 'opaqueness' seems to kick in and the view beneath the modalview is no longer visible.

If I create the view using a nib, it slides in as you'd 开发者_运维问答expect, fully covering any views beneath with no transparency issues.

I noticed that the Apple examples tend to use a nib-based view for ModalViews, but wondered why. Perhaps I'm missing something.....


It was down to a foolish coding error on my part.

I realised I'd copied/pasted some code from elsewhere into my ViewDidLoad

self.view.backgroundColor = [UIColor colorWithRed:0.6 green:0.4 blue:0.2 alpha:0.3];

I'd set a value of 0.3 for alpha.

Set it to 1.0 and transparency issue goes away...

Problem solved

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜