summaryrefslogtreecommitdiff
path: root/CyteKit/TabBarController.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2017-03-04 20:18:40 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2017-03-04 20:18:40 -0800
commit217e22f0f4f84e74a3649d5e292c283b0c468b7f (patch)
tree829acf2e2906067ced0604f8d77aeb72cda285eb /CyteKit/TabBarController.mm
parent60bd32466fcc4830ee8ff1774cd2e8d5bf390f4a (diff)
Move some code of Window/TabBarController to Cyte.
Diffstat (limited to 'CyteKit/TabBarController.mm')
-rw-r--r--CyteKit/TabBarController.mm33
1 files changed, 29 insertions, 4 deletions
diff --git a/CyteKit/TabBarController.mm b/CyteKit/TabBarController.mm
index 35a2bd0..a6cd088 100644
--- a/CyteKit/TabBarController.mm
+++ b/CyteKit/TabBarController.mm
@@ -26,10 +26,6 @@
#include "iPhonePrivate.h"
#include <Menes/ObjectHandle.h>
-@implementation UITabBarController (Cydia)
-
-@end
-
@implementation CyteTabBarController {
_transient UIViewController *transient_;
_H<UIViewController> remembered_;
@@ -48,6 +44,35 @@
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];