romaonthego / REFrostedViewController

iOS 7/8 style blurred view controller that appears on top of your view controller.
MIT License
2.96k stars 494 forks source link

How to display FrostedViewController under Navigation bar ? #76

Closed toto263 closed 10 years ago

toto263 commented 10 years ago

Is it possible to display FrostedViewController under Navigation bar and fade only Navigation view area? I want to show FrostedViewController like Android drawer interface. http://developer.android.com/design/patterns/navigation-drawer.html

romaonthego commented 10 years ago

No, this is not possible.

timlai commented 10 years ago

Just add REFrostedViewController inside a UINavigationController.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

// Create content and menu controllers
//
DEMOMenuViewController *menuController = [[DEMOMenuViewController alloc] initWithStyle:UITableViewStylePlain];

// Create frosted view controller
//
REFrostedViewController *frostedViewController = [[REFrostedViewController alloc] initWithContentViewController:[[DEMOHomeViewController alloc] init] menuViewController:menuController];
frostedViewController.direction = REFrostedViewControllerDirectionLeft;
frostedViewController.liveBlurBackgroundStyle = REFrostedViewControllerLiveBackgroundStyleLight;
frostedViewController.liveBlur = YES;
frostedViewController.delegate = self;
frostedViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu"
    style:UIBarButtonItemStylePlain
    target:frostedViewController
    action:@selector(presentMenuViewController)];

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:frostedViewController];
// Make it a root controller
//
self.window.rootViewController = navigationController;
self.window.backgroundColor = [UIColor blackColor];
[self.window makeKeyAndVisible];
return YES;
}

and remember to change the contentInset of your menuViewController [self.tableView setContentInset:UIEdgeInsetsMake(44, 0, 0, 0)];

that's it ios 2014 7 10 4 47 49

By the way, I just put this answer at wrong thread, sorry.

myusuf08 commented 8 years ago

@timlai hei,thx for your answer ,but why my view always black ?