subview (like popout effect)
settingView = [[UIView alloc] initWithFrame:CGRectMake(300,-400, 400, 325)];
settingView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:settingView];
CGRect frame = settingView.frame;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.500];
frame.origin.y = 0;
settingView.fram开发者_如何学编程e = frame;
**[self.view setAlpha:.30f];
[self.settingView setAlpha:1.0f];**
[UIView commitAnimations];
I want the background to be blurred off, except settingView. But the whole view is being affected. What am I doing incorrectly?
You are setting alpha on the view, but if you only want the background to be transparent – I assume that is what you mean by 'blurred' – you need to set the background color to be transparent instead:
myView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.3];
精彩评论