diff --git a/JBWebViewController/JBWebViewController.m b/JBWebViewController/JBWebViewController.m index c536021..0561aa4 100644 --- a/JBWebViewController/JBWebViewController.m +++ b/JBWebViewController/JBWebViewController.m @@ -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; @@ -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 @@ -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]];