From 69cf0d4cdd7861abf802db2531c0c6cf93689d49 Mon Sep 17 00:00:00 2001 From: yiplee Date: Fri, 31 Aug 2018 11:09:55 +0800 Subject: [PATCH] Add shadow image to demo --- .../share/YPDemoConfigureViewController.m | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Examples/share/YPDemoConfigureViewController.m b/Examples/share/YPDemoConfigureViewController.m index 0f71119..2748443 100644 --- a/Examples/share/YPDemoConfigureViewController.m +++ b/Examples/share/YPDemoConfigureViewController.m @@ -29,6 +29,7 @@ @implementation YPDemoConfigureViewController { BOOL _barHidden; BOOL _transparent; BOOL _translucent; + BOOL _shadowImage; UIBarStyle _barStyle; NSArray *_colors; @@ -73,7 +74,7 @@ - (void) showNextViewControllerWithColor:(UIColor *)color { YPDemoContainerViewController *controller = [YPDemoContainerViewController new]; controller.title = @"Color"; - YPNavigationBarConfigurations conf = YPNavigationBarShowShadowImage; + YPNavigationBarConfigurations conf = YPNavigationBarConfigurationsDefault; if (_barHidden) { conf |= YPNavigationBarHidden; } @@ -88,6 +89,10 @@ - (void) showNextViewControllerWithColor:(UIColor *)color { conf |= YPNavigationBarStyleBlack; } + if (_shadowImage) { + conf |= YPNavigationBarShowShadowImage; + } + if (color) conf |= YPNavigationBarBackgroundStyleColor; controller.configurations = conf; @@ -115,6 +120,10 @@ - (void) showNextViewControllerWithBackgroundImageName:(NSString *)imageName { conf |= YPNavigationBarStyleBlack; } + if (_shadowImage) { + conf |= YPNavigationBarShowShadowImage; + } + conf |= YPNavigationBarBackgroundStyleImage; controller.configurations = conf; @@ -143,8 +152,10 @@ - (void) switchValueChanged:(UISwitch *)sender { } } else if (tag == 2) { _translucent = sender.isOn; - } else { + } else if (tag == 3) { _barStyle = sender.isOn ? UIBarStyleBlack : UIBarStyleDefault; + } else { + _shadowImage = sender.isOn; } } @@ -155,7 +166,7 @@ - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { } - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - if (section == 0) return 4; + if (section == 0) return 5; else if (section == 1) return _colors.count; else if (section == 2) return _imageNames.count; else if (section == 3) return 1; @@ -181,9 +192,12 @@ - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:( } else if (row == 2) { title = @"Translucent"; isOn = _translucent; - } else { + } else if (row == 3) { title = @"Black Bar Style"; isOn = _barStyle == UIBarStyleBlack; + } else { + title = @"Shadow Image"; + isOn = _shadowImage; } cell.textLabel.text = title;