forked from akosma/nib2objc
/
UITabBarItemProcessor.m
56 lines (49 loc) · 1.47 KB
/
UITabBarItemProcessor.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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