Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for UITabBar and UITabBarItem instances; application re…

…ady for version 1.0
  • Loading branch information...
commit 1a7c628eb676dd1fce27ffdace996aea8db51721 1 parent 29f6657
Adrian Kosmaczewski authored
View
1  Categories/NSNumber+Nib2ObjcExtensions.h
@@ -41,5 +41,6 @@
- (NSString *)barStyleString;
- (NSString *)barButtonItemStyleString;
- (NSString *)barButtonSystemItemString;
+- (NSString *)tabBarSystemItemString;
@end
View
17 Categories/NSNumber+Nib2ObjcExtensions.m
@@ -337,4 +337,21 @@ - (NSString *)barButtonSystemItemString
return [values objectAtIndex:[self intValue]];
}
+- (NSString *)tabBarSystemItemString
+{
+ NSArray *values = [NSArray arrayWithObjects:@"UITabBarSystemItemMore",
+ @"UITabBarSystemItemFavorites",
+ @"UITabBarSystemItemFeatured",
+ @"UITabBarSystemItemTopRated",
+ @"UITabBarSystemItemRecents",
+ @"UITabBarSystemItemContacts",
+ @"UITabBarSystemItemHistory",
+ @"UITabBarSystemItemBookmarks",
+ @"UITabBarSystemItemSearch",
+ @"UITabBarSystemItemDownloads",
+ @"UITabBarSystemItemMostRecent",
+ @"UITabBarSystemItemMostViewed", nil];
+ return [values objectAtIndex:[self intValue]];
+}
+
@end
View
4 Processors/Processor.m
@@ -34,6 +34,8 @@
#import "UIBarButtonItemProcessor.h"
#import "UISearchBarProcessor.h"
#import "UIToolbarProcessor.h"
+#import "UITabBarProcessor.h"
+#import "UITabBarItemProcessor.h"
@interface Processor (Protected)
@@ -73,6 +75,8 @@ + (Processor *)processorForClass:(NSString *)klass
else if ([klass isEqualToString:@"IBUIBarButtonItem"]) processor = [[UIBarButtonItemProcessor alloc] init];
else if ([klass isEqualToString:@"IBUISearchBar"]) processor = [[UISearchBarProcessor alloc] init];
else if ([klass isEqualToString:@"IBUIToolbar"]) processor = [[UIToolbarProcessor alloc] init];
+ else if ([klass isEqualToString:@"IBUITabBar"]) processor = [[UITabBarProcessor alloc] init];
+ else if ([klass isEqualToString:@"IBUITabBarItem"]) processor = [[UITabBarItemProcessor alloc] init];
return [processor autorelease];
}
View
13 Processors/UITabBarItemProcessor.h
@@ -0,0 +1,13 @@
+//
+// UITabBarItemProcessor.h
+// nib2objc
+//
+// Created by Adrian on 3/17/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "UIBarItemProcessor.h"
+
+@interface UITabBarItemProcessor : UIBarItemProcessor
+
+@end
View
56 Processors/UITabBarItemProcessor.m
@@ -0,0 +1,56 @@
+//
+// UITabBarItemProcessor.m
+// nib2objc
+//
+// Created by Adrian on 3/17/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "UITabBarItemProcessor.h"
+#import "NSString+Nib2ObjcExtensions.h"
+#import "NSNumber+Nib2ObjcExtensions.h"
+
+@implementation UITabBarItemProcessor
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+- (NSString *)getProcessedClassName
+{
+ return @"UITabBarItem";
+}
+
+- (NSString *)constructorString
+{
+ NSString *constructor = @"";
+ NSNumber *systemItemIdentifier = [self.input objectForKey:@"systemItemIdentifier"];
+ if ([systemItemIdentifier intValue] == -1)
+ {
+ NSString *title = [[self.input objectForKey:@"title"] quotedAsCodeString];
+ NSString *tag = [[self.input objectForKey:@"tag"] intString];
+ constructor = [NSString stringWithFormat:@"[[%@ alloc] initWithTitle:%@ image:nil tag:%@]", [self getProcessedClassName], title, tag];
+ }
+ else
+ {
+ NSString *systemItem = [systemItemIdentifier tabBarSystemItemString];
+ NSString *tag = [[self.input objectForKey:@"tag"] intString];
+ constructor = [NSString stringWithFormat:@"[[%@ alloc] initWithTabBarSystemItem:%@ tag:%@]", [self getProcessedClassName], systemItem, tag];
+ }
+ return constructor;
+}
+
+- (void)processKey:(id)item value:(id)value
+{
+ if ([item isEqualToString:@"badgeValue"])
+ {
+ [output setObject:[value quotedAsCodeString] forKey:item];
+ }
+ else
+ {
+ [super processKey:item value:value];
+ }
+}
+
+@end
View
13 Processors/UITabBarProcessor.h
@@ -0,0 +1,13 @@
+//
+// UITabBarProcessor.h
+// nib2objc
+//
+// Created by Adrian on 3/17/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "UIViewProcessor.h"
+
+@interface UITabBarProcessor : UIViewProcessor
+
+@end
View
26 Processors/UITabBarProcessor.m
@@ -0,0 +1,26 @@
+//
+// UITabBarProcessor.m
+// nib2objc
+//
+// Created by Adrian on 3/17/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "UITabBarProcessor.h"
+
+@implementation UITabBarProcessor
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+- (NSString *)getProcessedClassName
+{
+ return @"UITabBar";
+}
+
+// This class does not override
+// - (void)processKey:(id)item value:(id)value
+
+@end
View
3  TestViewController.xib
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="40"/>
+ <integer value="50"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -510,6 +510,7 @@ AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA</b
</object>
<object class="IBUITabBarItem" id="389670566">
<string key="IBUITitle">Item</string>
+ <string key="IBUIBadgeValue">12</string>
<reference key="IBUITabBar" ref="862164565"/>
</object>
<object class="IBUITabBarItem" id="1044038919">
View
12 nib2objc.xcodeproj/project.pbxproj
@@ -36,6 +36,8 @@
3ACDD3BF0F6FE43A008EA9F2 /* UIBarItemProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 3ACDD3BE0F6FE43A008EA9F2 /* UIBarItemProcessor.m */; };
3ACDD4310F6FF052008EA9F2 /* UISearchBarProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 3ACDD4300F6FF052008EA9F2 /* UISearchBarProcessor.m */; };
3ACDD44F0F6FF267008EA9F2 /* UIToolbarProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 3ACDD44E0F6FF267008EA9F2 /* UIToolbarProcessor.m */; };
+ 3ACDD4720F6FF5CB008EA9F2 /* UITabBarProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 3ACDD4710F6FF5CB008EA9F2 /* UITabBarProcessor.m */; };
+ 3ACDD47E0F6FF6D2008EA9F2 /* UITabBarItemProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 3ACDD47D0F6FF6D2008EA9F2 /* UITabBarItemProcessor.m */; };
3AD51EDD0F6AF0D1002D7519 /* UIViewProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AD51EDC0F6AF0D1002D7519 /* UIViewProcessor.m */; };
8DD76F9A0486AA7600D96B5E /* nib2objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* nib2objc.m */; settings = {ATTRIBUTES = (); }; };
8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
@@ -115,6 +117,10 @@
3ACDD4300F6FF052008EA9F2 /* UISearchBarProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISearchBarProcessor.m; sourceTree = "<group>"; };
3ACDD44D0F6FF267008EA9F2 /* UIToolbarProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIToolbarProcessor.h; sourceTree = "<group>"; };
3ACDD44E0F6FF267008EA9F2 /* UIToolbarProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIToolbarProcessor.m; sourceTree = "<group>"; };
+ 3ACDD4700F6FF5CB008EA9F2 /* UITabBarProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITabBarProcessor.h; sourceTree = "<group>"; };
+ 3ACDD4710F6FF5CB008EA9F2 /* UITabBarProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITabBarProcessor.m; sourceTree = "<group>"; };
+ 3ACDD47C0F6FF6D2008EA9F2 /* UITabBarItemProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITabBarItemProcessor.h; sourceTree = "<group>"; };
+ 3ACDD47D0F6FF6D2008EA9F2 /* UITabBarItemProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITabBarItemProcessor.m; sourceTree = "<group>"; };
3AD51E600F6ABD0A002D7519 /* TestViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TestViewController.xib; sourceTree = "<group>"; };
3AD51EDB0F6AF0D1002D7519 /* UIViewProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIViewProcessor.h; sourceTree = "<group>"; };
3AD51EDC0F6AF0D1002D7519 /* UIViewProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIViewProcessor.m; sourceTree = "<group>"; };
@@ -249,6 +255,10 @@
3ACDD4300F6FF052008EA9F2 /* UISearchBarProcessor.m */,
3ACDD44D0F6FF267008EA9F2 /* UIToolbarProcessor.h */,
3ACDD44E0F6FF267008EA9F2 /* UIToolbarProcessor.m */,
+ 3ACDD4700F6FF5CB008EA9F2 /* UITabBarProcessor.h */,
+ 3ACDD4710F6FF5CB008EA9F2 /* UITabBarProcessor.m */,
+ 3ACDD47C0F6FF6D2008EA9F2 /* UITabBarItemProcessor.h */,
+ 3ACDD47D0F6FF6D2008EA9F2 /* UITabBarItemProcessor.m */,
);
path = Processors;
sourceTree = "<group>";
@@ -327,6 +337,8 @@
3ACDD3BF0F6FE43A008EA9F2 /* UIBarItemProcessor.m in Sources */,
3ACDD4310F6FF052008EA9F2 /* UISearchBarProcessor.m in Sources */,
3ACDD44F0F6FF267008EA9F2 /* UIToolbarProcessor.m in Sources */,
+ 3ACDD4720F6FF5CB008EA9F2 /* UITabBarProcessor.m in Sources */,
+ 3ACDD47E0F6FF6D2008EA9F2 /* UITabBarItemProcessor.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Please sign in to comment.
Something went wrong with that request. Please try again.