]> git.saurik.com Git - cydia.git/blobdiff - CyteKit/TabBarController.mm
Fix the System user-agent component (this rotted).
[cydia.git] / CyteKit / TabBarController.mm
index 35a2bd0f6717dd8893e9fa94d3faecd19f48c227..a6cd088bd452a0179d7d5d0469ffd05d6aec9350 100644 (file)
 #include "iPhonePrivate.h"
 #include <Menes/ObjectHandle.h>
 
-@implementation UITabBarController (Cydia)
-
-@end
-
 @implementation CyteTabBarController {
     _transient UIViewController *transient_;
     _H<UIViewController> remembered_;
     return items;
 }
 
+- (void) addViewControllers:(id)no, ... {
+    va_list args;
+    va_start(args, no);
+
+    NSMutableArray *controllers([NSMutableArray array]);
+
+    for (;;) {
+        auto title(va_arg(args, NSString *));
+        if (title == nil)
+            break;
+
+        UINavigationController *controller([[[UINavigationController alloc] init] autorelease]);
+        [controllers addObject:controller];
+
+        auto legacy(va_arg(args, NSString *));
+        auto normal(va_arg(args, NSString *));
+        auto select(va_arg(args, NSString *));
+
+        if (kCFCoreFoundationVersionNumber < 800)
+            [controller setTabBarItem:[[[UITabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:legacy] tag:0] autorelease]];
+        else
+            [controller setTabBarItem:[[[UITabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:normal] selectedImage:[UIImage imageNamed:select]] autorelease]];
+    }
+
+    va_end(args);
+
+    [self setViewControllers:controllers];
+}
+
 - (void) didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];