Ios 带有模糊TableView滚动偏移的透明导航栏
我试图创造这种效果 仅在“滚动偏移”视图上产生模糊效果 我试着以编程的方式做这件事,如下所示Ios 带有模糊TableView滚动偏移的透明导航栏,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我试图创造这种效果 仅在“滚动偏移”视图上产生模糊效果 我试着以编程的方式做这件事,如下所示 - (void)addBlurEffect { // Add blur view // CGRect statusBarViewRect = [[UIApplication sharedApplication] statusBarFrame]; CGRect bounds = self.bounds; /*to extwnd from status bar ti
- (void)addBlurEffect {
// Add blur view
// CGRect statusBarViewRect = [[UIApplication sharedApplication] statusBarFrame];
CGRect bounds = self.bounds;
/*to extwnd from status bar till the end of navigation bar height*/
CGRect aRect = CGRectMake(0, self.frame.origin.y-40, self.frame.size.width, bounds.size.height+20);
/*Make a blur view*/
UIVisualEffectView *visualView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
/*Assign a tag to make it accessable from view hirarchy*/
visualView.tag = 10000;
visualView.frame = aRect;
visualView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self addSubview:visualView];
self.backgroundColor = [UIColor colorWithRed:42.0f green:152.0f blue:231.0f alpha:0.7f];
[self sendSubviewToBack:visualView];
/*back button was disabled following enables it*/
visualView.userInteractionEnabled = false;
}
我无法重新创建UI。这就是我得到的
渐变效果,而不是清晰的视图。如何重新创建所需的UI效果?试试这个:-
self.tableView.contentInset=UIEdgeInsetsMake(44,0,0) 试试这个:-
self.tableView.contentInset=UIEdgeInsetsMake(44,0,0) 使用此选项为视图添加模糊效果 var blurEffectView:UIVisualEffectView
func addblurEffectToView()
{
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
blurEffectView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] // for supporting device rotation
blurEffectView.alpha = 1
view.addSubview(blurEffectView)
}
使用此选项可向视图添加模糊效果 var blurEffectView:UIVisualEffectView
func addblurEffectToView()
{
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
blurEffectView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] // for supporting device rotation
blurEffectView.alpha = 1
view.addSubview(blurEffectView)
}
当我在导航栏下的表格视图中按下时,我需要得到上面看到的模糊效果。我得到了一个渐变效果,并且不是透明的,这是我在问题中分享的。我需要得到你在上面看到的模糊效果,当我在导航栏下的表格视图中按下时。我得到了一个渐变效果,不透明,这是我在问题中分享的。