Skip to content
This repository was archived by the owner on Nov 15, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions JBWebViewController/JBWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceO

#pragma mark - "Setup"

- (UIImage *)imageFromBundleWithName:(NSString *)imageName {
return [UIImage imageNamed:imageName
inBundle:[NSBundle bundleForClass:[self class]]
compatibleWithTraitCollection:nil];
}

- (void)setup {
// Default value
_hasExtraButtons = NO;
Expand Down Expand Up @@ -119,12 +125,12 @@ - (void)setup {

[_titleView addSubview:_titleLabel];
[_titleView addSubview:_subtitleLabel];

self.navigationItem.titleView = _titleView;

// Inset right buttons
UIBarButtonItem *shareButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Share"] style:UIBarButtonItemStylePlain target:self action:@selector(share)];
UIBarButtonItem *dismissButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Dismiss"] style:UIBarButtonItemStylePlain target:self action:@selector(dismiss)];
UIBarButtonItem *shareButton = [[UIBarButtonItem alloc] initWithImage:[self imageFromBundleWithName:@"Share"] style:UIBarButtonItemStylePlain target:self action:@selector(share)];
UIBarButtonItem *dismissButton = [[UIBarButtonItem alloc] initWithImage:[self imageFromBundleWithName:@"Dismiss"] style:UIBarButtonItemStylePlain target:self action:@selector(dismiss)];
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:dismissButton, shareButton, nil]];

// Add a webview
Expand Down Expand Up @@ -273,8 +279,8 @@ - (void)adjustNavigationbar {

- (void)addNavigationButtonsButtons {
// Creating buttons
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Back"] style:UIBarButtonItemStylePlain target:self action:@selector(navigateBack)];
UIBarButtonItem *forwardButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Forward"] style:UIBarButtonItemStylePlain target:self action:@selector(navigateForward)];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[self imageFromBundleWithName:@"Back"] style:UIBarButtonItemStylePlain target:self action:@selector(navigateBack)];
UIBarButtonItem *forwardButton = [[UIBarButtonItem alloc] initWithImage:[self imageFromBundleWithName:@"Forward"] style:UIBarButtonItemStylePlain target:self action:@selector(navigateForward)];

// Adding buttons to NavigationBar
[self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:backButton, forwardButton, nil]];
Expand Down