我的应用程序需要在主视图控制器顶部显示帮助。我已将tabbar控制器作为根视图控制器并添加了导航视图控制器。因此,在第一个屏幕的外观中,标签栏和导航栏都与视图体一起出现。当我尝试通过pageviewcontroller示例放置帮助屏幕时,在第一个屏幕选项卡视图和导航栏中加载了第一个屏幕标签视图和导航栏正在前面保持页面视图控制器。我已经尝试过了
[self addChildViewController:walkthrough];
[self.view addSubview:walkthrough.view];
[self.tabBarController.view bringSubviewToFront:walkthrough.view];
请帮助如何获取页面视图屏幕。并且有任何示例教程请帮帮我 注意:Botn导航栏和tabbar不应隐藏
答案 0 :(得分:1)
这是我在我的应用程序中为演练所做的。你可以从这里下载这个FXBlurView库: https://github.com/nicklockwood/FXBlurView
在我的.h文件中
#import "FXBlurView.h"
IBOutlet UIView *viewWalkThrough;
FXBlurView *overlayView;
在我的.m文件中
#define SYSTEM_SCREEN_SIZE [[UIScreen mainScreen] bounds].size
#define kProfileWalkthrough @"ProfileWalkthrough"
if (![[[NSUserDefaults standardUserDefaults] valueForKey:kProfileWalkthrough] boolValue]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kProfileWalkthrough];
[[NSUserDefaults standardUserDefaults] synchronize];
overlayView = [[FXBlurView alloc] initWithFrame:CGRectMake(0, 0, SYSTEM_SCREEN_SIZE.width, SYSTEM_SCREEN_SIZE.height)];
[overlayView setDynamic:YES];
[overlayView setBlurRadius:5.0f];
[overlayView setBlurEnabled:YES];
[overlayView setTintColor:[UIColor blackColor]];
[self.view.window addSubview:overlayView];
[self displayOverlay:viewWalkThrough aboveView:self.view.window];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeWalkThrough:)];
[viewWalkThrough addGestureRecognizer:tapGesture];
}
- (void)closeWalkThrough:(UITapGestureRecognizer *)tapRecognizer {
[overlayView removeFromSuperview];
[self.viewWalkThrough removeFromSuperview];
}
- (void)displayOverlay:(UIView *)subView aboveView:(UIView *)superView {
subView.translatesAutoresizingMaskIntoConstraints = NO;
[superView addSubview:subView];
[superView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[subView]|" options:kNilOptions metrics:nil views:NSDictionaryOfVariableBindings(subView)]];
[superView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[subView]|" options:kNilOptions metrics:nil views:NSDictionaryOfVariableBindings(subView)]];
[superView layoutSubviews];
}