Greg
Greg

Reputation: 1055

Transparency around UIWebView

I have a UIView with a "advertisement" and I want to be able to have a UIWebView popup window appear over top of the advertisement.

I want to be able to have everything except the UIWebView become a dimmed black transparent.. Is this possible?

Let me know if this is clear or not. You see it on many websites

Thanks

Upvotes: 2

Views: 231

Answers (2)

UIView *vie=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 360, 480)];

[vie setOpaque:NO];

[vie setBackgroundColor:[UIColor clearColor]];


UIWebView *urwebiew=[[UIWebView alloc]initWithFrame:CGRectMake(40, 40, 200, 200)];


    //.................

[vie addSubview:urwebiew];


now the view is ready with transparent to use 

Upvotes: 1

PengOne
PengOne

Reputation: 48398

You can add a view over the entire screen with a small alpha (making it more (close to 0) or less (close to 1) transparent). By setting userInteractionEnabled to NO, you can prevent anything under this view from responding to touch events. Then add your UIWebView to that.

Upvotes: 1

Related Questions