UIBarButtonItem+Theme.m 2.05 KB
Newer Older
1 2 3 4
/*****************************************************************************
 * UIBarButtonItem+Theme.m
 * VLC for iOS
 *****************************************************************************
5
 * Copyright (c) 2013-2017 VideoLAN. All rights reserved.
6 7 8 9 10 11 12
 * $Id$
 *
 * Authors: Felix Paul Kühne <fkuehne # videolan.org>
 *          Fabio Ritrovato <sephiroth87 # videolan.org>
 *
 * Refer to the COPYING file of the official project for license.
 *****************************************************************************/
13

14
@implementation UIBarButtonItem (ThemedButtons)
15 16 17

+ (UIBarButtonItem *)themedBackButtonWithTarget:(id)target andSelector:(SEL)selector
{
18
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_BACK", nil)
19
                                                                   style:UIBarButtonItemStylePlain
20 21
                                                                  target:target
                                                                  action:selector];
Felix Paul Kühne's avatar
Felix Paul Kühne committed
22
    backButton.tintColor = [UIColor whiteColor];
23 24
    NSShadow *shadow = [[NSShadow alloc] init];
    [backButton setTitleTextAttributes:@{NSShadowAttributeName : shadow, NSForegroundColorAttributeName : [UIColor whiteColor]} forState:UIControlStateNormal];
Fabio Ritrovato's avatar
Fabio Ritrovato committed
25
    [backButton setTitlePositionAdjustment:UIOffsetMake(3, 0) forBarMetrics:UIBarMetricsDefault];
26 27 28
    return backButton;
}

29 30
+ (UIBarButtonItem *)themedDarkToolbarButtonWithTitle:(NSString*)title target:(id)target andSelector:(SEL)selector
{
31
    UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStylePlain target:target action:selector];
Felix Paul Kühne's avatar
Felix Paul Kühne committed
32
    button.tintColor = [UIColor whiteColor];
33 34 35

    return button;
}
36 37 38 39 40 41 42 43 44 45

+ (UIBarButtonItem *)themedPlayAllButtonWithTarget:(id)target andSelector:(SEL)selector
{
    UIBarButtonItem *playAllButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:target action:selector];
    playAllButton.accessibilityLabel = NSLocalizedString(@"PLAY_ALL_BUTTON", nil);

    return playAllButton;
}

@end