瀏覽代碼

menu: fix incomplete xmas icon implementation which prevented the hat from appearing on non-library tabs

Felix Paul Kühne 11 年之前
父節點
當前提交
2131dcc51f
共有 2 個文件被更改,包括 15 次插入13 次删除
  1. 15 1
      Sources/UIBarButtonItem+Theme.m
  2. 0 12
      Sources/VLCPlaylistViewController.m

+ 15 - 1
Sources/UIBarButtonItem+Theme.m

@@ -59,7 +59,21 @@
 
 + (UIBarButtonItem *)themedRevealMenuButtonWithTarget:(id)target andSelector:(SEL)selector
 {
-    UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"menuCone"] style:UIBarButtonItemStyleBordered target:target action:selector];
+    /* After day 354 of the year, the usual VLC cone is replaced by another cone
+     * wearing a Father Xmas hat.
+     * Note: this icon doesn't represent an endorsement of The Coca-Cola Company
+     * and should not be confused with the idea of religious statements or propagation there off
+     */
+    NSCalendar *gregorian =
+    [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
+    NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:[NSDate date]];
+    UIImage *icon;
+    if (dayOfYear >= 354)
+        icon = [UIImage imageNamed:@"vlc-xmas"];
+    else
+        icon = [UIImage imageNamed:@"menuCone"];
+
+    UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStyleBordered target:target action:selector];
     if (SYSTEM_RUNS_IOS7_OR_LATER)
         menuButton.tintColor = [UIColor whiteColor];
     else {

+ 0 - 12
Sources/VLCPlaylistViewController.m

@@ -99,18 +99,6 @@
     [super viewDidLoad];
     self.title = NSLocalizedString(@"LIBRARY_ALL_FILES", @"");
     _menuButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(leftButtonAction:)];
-
-    /* After day 354 of the year, the usual VLC cone is replaced by another cone
-     * wearing a Father Xmas hat.
-     * Note: this icon doesn't represent an endorsement of The Coca-Cola Company
-     * and should not be confused with the idea of religious statements or propagation there off
-     */
-    NSCalendar *gregorian =
-    [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
-    NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:[NSDate date]];
-    if (dayOfYear >= 354)
-        _menuButton.image = [UIImage imageNamed:@"vlc-xmas"];
-
     self.navigationItem.leftBarButtonItem = _menuButton;
 
     if (SYSTEM_RUNS_IOS7_OR_LATER)