Commit 22d16e34 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Factorize themed back button

parent 9a4b4b49
......@@ -12,4 +12,5 @@
@interface UIBarButtonItem (Theme)
+ (UIBarButtonItem *)themedDoneButtonWithTarget:(id)target andSelector:(SEL)selector;
+ (UIBarButtonItem *)themedBackButtonWithTarget:(id)target andSelector:(SEL)selector;
@end
......@@ -27,4 +27,22 @@
forState:UIControlStateNormal];
return doneButton;
}
+ (UIBarButtonItem *)themedBackButtonWithTarget:(id)target andSelector:(SEL)selector
{
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_BACK", @"")
style:UIBarButtonItemStyleBordered
target:target
action:selector];
[backButton setBackgroundImage:[UIImage imageNamed:@"backButton"]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[backButton setBackgroundImage:[UIImage imageNamed:@"backButtonHighlight"]
forState:UIControlStateHighlighted
barMetrics:UIBarMetricsDefault];
[backButton setTitleTextAttributes:@{UITextAttributeTextShadowColor : [UIColor whiteColor], UITextAttributeTextColor : [UIColor blackColor]}
forState:UIControlStateNormal];
return backButton;
}
@end
......@@ -14,6 +14,7 @@
#import "VLCAppDelegate.h"
#import "VLCPlaylistViewController.h"
#import "VLCDropboxConstants.h"
#import "UIBarButtonItem+Theme.h"
#import <DropboxSDK/DropboxSDK.h>
@interface VLCDropboxTableViewController ()
......@@ -50,9 +51,7 @@
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dropbox-white"]];
self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
_backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(goBack:)];
[_backButton setBackgroundImage:[UIImage imageNamed:@"backButton"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[_backButton setBackgroundImage:[UIImage imageNamed:@"backButtonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
_backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack:)];
self.navigationItem.leftBarButtonItem = _backButton;
self.tableView.rowHeight = [VLCDropboxTableViewCell heightOfCell];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment