Skip to content

Commit

Permalink
Add shadow image to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
yiplee committed Aug 31, 2018
1 parent e13eb2b commit 69cf0d4
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Examples/share/YPDemoConfigureViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ @implementation YPDemoConfigureViewController {
BOOL _barHidden;
BOOL _transparent;
BOOL _translucent;
BOOL _shadowImage;
UIBarStyle _barStyle;

NSArray<NSDictionary *> *_colors;
Expand Down Expand Up @@ -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;
}
Expand All @@ -88,6 +89,10 @@ - (void) showNextViewControllerWithColor:(UIColor *)color {
conf |= YPNavigationBarStyleBlack;
}

if (_shadowImage) {
conf |= YPNavigationBarShowShadowImage;
}

if (color) conf |= YPNavigationBarBackgroundStyleColor;

controller.configurations = conf;
Expand Down Expand Up @@ -115,6 +120,10 @@ - (void) showNextViewControllerWithBackgroundImageName:(NSString *)imageName {
conf |= YPNavigationBarStyleBlack;
}

if (_shadowImage) {
conf |= YPNavigationBarShowShadowImage;
}

conf |= YPNavigationBarBackgroundStyleImage;

controller.configurations = conf;
Expand Down Expand Up @@ -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;
}
}

Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 69cf0d4

Please sign in to comment.