├── .gitignore ├── .gitmodules ├── Action and Service ├── Convert with nib2objc.h ├── Convert with nib2objc.m ├── Convert with nib2objc.xcodeproj │ └── project.pbxproj ├── Convert with nib2objc_Prefix.pch ├── English.lproj │ ├── InfoPlist.strings │ └── main.xib └── Info.plist ├── Command Line ├── Command Line.xcodeproj │ └── project.pbxproj └── nib2objc │ ├── main.m │ └── nib2objc-Prefix.pch ├── Contrib └── nibs2objc.pl ├── GUI ├── AppDelegate.h ├── AppDelegate.m ├── English.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ ├── MainMenu.xib │ └── MyDocument.xib ├── GUI App.xcodeproj │ └── project.pbxproj ├── MyDocument.h ├── MyDocument.m ├── main.m ├── nib2objc-Info.plist ├── nib2objc.icns ├── nib2objc.icns.ai └── nib2objc_Prefix.pch ├── LICENSE ├── NibProcessor ├── Categories │ ├── NSDictionary+Nib2ObjcExtensions.h │ ├── NSDictionary+Nib2ObjcExtensions.m │ ├── NSNumber+Nib2ObjcExtensions.h │ ├── NSNumber+Nib2ObjcExtensions.m │ ├── NSString+Nib2ObjcExtensions.h │ └── NSString+Nib2ObjcExtensions.m ├── NibProcessor.h ├── NibProcessor.m └── Processors │ ├── GLKViewControllerProcessor.h │ ├── GLKViewControllerProcessor.m │ ├── GLKViewProcessor.h │ ├── GLKViewProcessor.m │ ├── MKMapViewProcessor.h │ ├── MKMapViewProcessor.m │ ├── Processor.h │ ├── Processor.m │ ├── ProxyObjectProcessor.h │ ├── ProxyObjectProcessor.m │ ├── UIActivityIndicatorViewProcessor.h │ ├── UIActivityIndicatorViewProcessor.m │ ├── UIBarButtonItemProcessor.h │ ├── UIBarButtonItemProcessor.m │ ├── UIBarItemProcessor.h │ ├── UIBarItemProcessor.m │ ├── UIButtonProcessor.h │ ├── UIButtonProcessor.m │ ├── UIControlProcessor.h │ ├── UIControlProcessor.m │ ├── UIDatePickerProcessor.h │ ├── UIDatePickerProcessor.m │ ├── UIGestureRecognizerProcessor.h │ ├── UIGestureRecognizerProcessor.m │ ├── UIImageViewProcessor.h │ ├── UIImageViewProcessor.m │ ├── UILabelProcessor.h │ ├── UILabelProcessor.m │ ├── UILongPressGestureRecognizerProcessor.h │ ├── UILongPressGestureRecognizerProcessor.m │ ├── UINavigationBarProcessor.h │ ├── UINavigationBarProcessor.m │ ├── UINavigationItemProcessor.h │ ├── UINavigationItemProcessor.m │ ├── UIPageControlProcessor.h │ ├── UIPageControlProcessor.m │ ├── UIPanGestureRecognizerProcessor.h │ ├── UIPanGestureRecognizerProcessor.m │ ├── UIPickerViewProcessor.h │ ├── UIPickerViewProcessor.m │ ├── UIPinchGestureRecognizerProcessor.h │ ├── UIPinchGestureRecognizerProcessor.m │ ├── UIProgressViewProcessor.h │ ├── UIProgressViewProcessor.m │ ├── UIRotationGestureRecognizerProcessor.h │ ├── UIRotationGestureRecognizerProcessor.m │ ├── UIScrollViewProcessor.h │ ├── UIScrollViewProcessor.m │ ├── UISearchBarProcessor.h │ ├── UISearchBarProcessor.m │ ├── UISegmentedControlProcessor.h │ ├── UISegmentedControlProcessor.m │ ├── UISliderProcessor.h │ ├── UISliderProcessor.m │ ├── UIStepperProcessor.h │ ├── UIStepperProcessor.m │ ├── UISwipeGestureRecognizerProcessor.h │ ├── UISwipeGestureRecognizerProcessor.m │ ├── UISwitchProcessor.h │ ├── UISwitchProcessor.m │ ├── UITabBarItemProcessor.h │ ├── UITabBarItemProcessor.m │ ├── UITabBarProcessor.h │ ├── UITabBarProcessor.m │ ├── UITableViewCellProcessor.h │ ├── UITableViewCellProcessor.m │ ├── UITableViewControllerProcessor.h │ ├── UITableViewControllerProcessor.m │ ├── UITableViewProcessor.h │ ├── UITableViewProcessor.m │ ├── UITapGestureRecognizerProcessor.h │ ├── UITapGestureRecognizerProcessor.m │ ├── UITextFieldProcessor.h │ ├── UITextFieldProcessor.m │ ├── UITextViewProcessor.h │ ├── UITextViewProcessor.m │ ├── UIToolbarProcessor.h │ ├── UIToolbarProcessor.m │ ├── UIViewControllerProcessor.h │ ├── UIViewControllerProcessor.m │ ├── UIViewProcessor.h │ ├── UIViewProcessor.m │ ├── UIWebViewProcessor.h │ └── UIWebViewProcessor.m ├── README.textile └── Sample ├── TestViewController.xib ├── sample.m └── sample.sh /.gitignore: -------------------------------------------------------------------------------- 1 | Documentation 2 | build 3 | *.pbxuser 4 | *.mode2v3 5 | *.mode1v3 6 | .DS_Store 7 | 8 | *.perspectivev3 9 | xcuserdata 10 | project.xcworkspace 11 | 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "GUI/Externals/Fragaria"] 2 | path = GUI/Externals/Fragaria 3 | url = http://github.com/mugginsoft/Fragaria.git 4 | -------------------------------------------------------------------------------- /Action and Service/Convert with nib2objc.h: -------------------------------------------------------------------------------- 1 | // 2 | // Convert with nib2objc.h 3 | // Convert with nib2objc 4 | // 5 | // Created by Adrian on 7/17/10. 6 | // Copyright (c) 2010 akosma software, All Rights Reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface Convert_with_nib2objc : AMBundleAction 13 | { 14 | } 15 | 16 | - (id)runWithInput:(id)input fromAction:(AMAction *)anAction error:(NSDictionary **)errorInfo; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Action and Service/Convert with nib2objc.m: -------------------------------------------------------------------------------- 1 | // 2 | // Convert with nib2objc.m 3 | // Convert with nib2objc 4 | // 5 | // Created by Adrian on 7/17/10. 6 | // Copyright (c) 2010 akosma software, All Rights Reserved. 7 | // 8 | 9 | #import "Convert with nib2objc.h" 10 | #import "NibProcessor.h" 11 | 12 | @implementation Convert_with_nib2objc 13 | 14 | - (id)runWithInput:(id)input fromAction:(AMAction *)anAction error:(NSDictionary **)errorInfo 15 | { 16 | // Use a Processor instance to generate the source code file 17 | // and redirect the output to the standard output stream 18 | // Important: in the context of animator services, "input" 19 | // is an array with string filenames. 20 | NibProcessor *processor = [[[NibProcessor alloc] init] autorelease]; 21 | processor.input = [input objectAtIndex:0]; 22 | [processor process]; 23 | return processor.output; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Action and Service/Convert with nib2objc_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Convert with nib2objc' target in the 'Convert with nib2objc' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Action and Service/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akosma/nib2objc/cde9b9e8804a93c297681fd1aeed0c56719493f4/Action and Service/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /Action and Service/English.lproj/main.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1040 5 | 10A96 6 | 700 7 | 975.1 8 | 388.00 9 | 10 | YES 11 | 12 | 13 | 14 | YES 15 | com.apple.InterfaceBuilder.CocoaPlugin 16 | 17 | 18 | YES 19 | 20 | AMBundleAction 21 | 22 | 23 | FirstResponder 24 | 25 | 26 | 27 | 256 28 | 29 | YES 30 | 31 | 32 | 256 33 | {{130, 36}, {140, 14}} 34 | 35 | YES 36 | 37 | 67239424 38 | 4325376 39 | (* UI elements go here. *) 40 | 41 | LucidaGrande 42 | 1.100000e+01 43 | 3100 44 | 45 | 46 | 47 | 6 48 | System 49 | controlColor 50 | 51 | 3 52 | MC42NjY2NjY2OQA 53 | 54 | 55 | 56 | 6 57 | System 58 | controlTextColor 59 | 60 | 3 61 | MAA 62 | 63 | 64 | 65 | 66 | 67 | {400, 85} 68 | 69 | 70 | NSView 71 | 72 | NSResponder 73 | 74 | 75 | YES 76 | 77 | 78 | 79 | NSApplication 80 | 81 | 82 | 83 | 84 | YES 85 | 86 | 87 | view 88 | 89 | 90 | 91 | 7 92 | 93 | 94 | 95 | contentObject: parameters 96 | 97 | 98 | 99 | 100 | 101 | contentObject: parameters 102 | contentObject 103 | parameters 104 | 2 105 | 106 | 107 | 12 108 | 109 | 110 | 111 | 112 | YES 113 | 114 | 0 115 | 116 | YES 117 | 118 | 119 | 120 | 121 | 122 | -2 123 | 124 | 125 | RmlsZSdzIE93bmVyA 126 | 127 | 128 | -1 129 | 130 | 131 | First Responder 132 | 133 | 134 | 5 135 | 136 | 137 | YES 138 | 139 | 140 | 141 | View 142 | 143 | 144 | 9 145 | 146 | 147 | YES 148 | 149 | 150 | 151 | 152 | 153 | 6 154 | 155 | 156 | Parameters 157 | 158 | 159 | 100009 160 | 161 | 162 | 163 | 164 | -3 165 | 166 | 167 | Application 168 | 169 | 170 | 171 | 172 | YES 173 | 174 | YES 175 | -1.IBPluginDependency 176 | -2.IBPluginDependency 177 | 5.IBEditorWindowLastContentRect 178 | 5.IBPluginDependency 179 | 5.ImportedFromIB2 180 | 5.editorWindowContentRectSynchronizationRect 181 | 6.IBPluginDependency 182 | 6.ImportedFromIB2 183 | 9.IBPluginDependency 184 | 9.ImportedFromIB2 185 | 186 | 187 | YES 188 | com.apple.InterfaceBuilder.CocoaPlugin 189 | com.apple.InterfaceBuilder.CocoaPlugin 190 | {{74, 1060}, {400, 85}} 191 | com.apple.InterfaceBuilder.CocoaPlugin 192 | 193 | {{21, 726}, {400, 85}} 194 | com.apple.InterfaceBuilder.CocoaPlugin 195 | 196 | com.apple.InterfaceBuilder.CocoaPlugin 197 | 198 | 199 | 200 | 201 | YES 202 | 203 | YES 204 | 205 | 206 | YES 207 | 208 | 209 | 210 | 211 | YES 212 | 213 | YES 214 | 215 | 216 | YES 217 | 218 | 219 | 220 | 100009 221 | 222 | 223 | 224 | YES 225 | 226 | AMBundleAction 227 | 228 | view 229 | NSView 230 | 231 | 232 | IBUserSource 233 | 234 | 235 | 236 | 237 | 238 | 0 239 | 240 | 3 241 | 242 | 243 | -------------------------------------------------------------------------------- /Action and Service/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AMAccepts 6 | 7 | Container 8 | List 9 | Optional 10 | 11 | Types 12 | 13 | com.apple.cocoa.path 14 | 15 | 16 | AMApplication 17 | (* Primary Application used by this action goes here. *) 18 | AMCanShowSelectedItemsWhenRun 19 | 20 | AMCanShowWhenRun 21 | 22 | AMCategory 23 | AMCategoryFilesAndFolders 24 | AMDefaultParameters 25 | 26 | AMDescription 27 | 28 | AMDAlert 29 | (* AMDAlert text goes here. (optional) *) 30 | AMDInput 31 | (* AMDInput text to further explain the types accepted as input goes here. (optional) *) 32 | AMDNote 33 | (* AMDNote text goes here. (optional) *) 34 | AMDOptions 35 | (* AMDOptions text to further explain configuration options in the UI goes here. (optional) *) 36 | AMDRelatedActions 37 | (* AMDRelatedActions bundle ids go here. (optional) *) 38 | AMDRequires 39 | (* AMDRequires text to explain anything outside of Automator required for the action's operation, e.g. a web page open in Safari, goes here. (optional) *) 40 | AMDResult 41 | (* AMDResult text to further explain the types provided as output goes here. (optional) *) 42 | AMDSummary 43 | (* AMDSummary text to explain what your action does goes here. *) 44 | AMDWebsite 45 | (* AMDWebsite URL to additional information or documentation for the action goes here. (optional) *) 46 | 47 | AMIconName 48 | (* The name of the icon *) 49 | AMKeywords 50 | 51 | AMName 52 | Convert with nib2objc 53 | AMProvides 54 | 55 | Container 56 | List 57 | Types 58 | 59 | com.apple.cocoa.string 60 | 61 | 62 | AMRequiredResources 63 | 64 | AMWarning 65 | 66 | Action 67 | (* Action name to be suggested to add prior to this action to make the task safer, e.g. com.apple.Automator.CopyFiles, goes here. *) 68 | ApplyButton 69 | (* Button label for user to add proposed Action, e.g. Add. *) 70 | IgnoreButton 71 | (* Button label for user not to add proposed Action, e.g. Don't Add. *) 72 | Level 73 | 0 74 | Message 75 | (* Warning message presented to user goes here. *) 76 | 77 | CFBundleDevelopmentRegion 78 | English 79 | CFBundleExecutable 80 | ${EXECUTABLE_NAME} 81 | CFBundleGetInfoString 82 | 1.0, Copyright © 2010 __MyCompanyName__, All Rights Reserved 83 | CFBundleIconFile 84 | 85 | CFBundleIdentifier 86 | com.yourcompany.Automator.${PRODUCT_NAME:identifier} 87 | CFBundleInfoDictionaryVersion 88 | 6.0 89 | CFBundleName 90 | ${PRODUCT_NAME} 91 | CFBundlePackageType 92 | BNDL 93 | CFBundleShortVersionString 94 | 1.0 95 | CFBundleSignature 96 | ???? 97 | CFBundleVersion 98 | 1.0 99 | NSHumanReadableCopyright 100 | Copyright © 2010 __MyCompanyName__, All Rights Reserved. 101 | NSPrincipalClass 102 | Convert_with_nib2objc 103 | 104 | 105 | -------------------------------------------------------------------------------- /Command Line/nib2objc/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #include 10 | #import 11 | #include "NibProcessor.h" 12 | 13 | int main (int argc, const char * argv[]) 14 | { 15 | 16 | @autoreleasepool { 17 | 18 | // Verify that we have the required number of parameters in the command line 19 | if (argc < 2) 20 | { 21 | printf("This utility requires a valid NIB file path as parameter.\n"); 22 | return 0; 23 | } 24 | 25 | // Test that the input file exists, and that it is not a directory 26 | NSString *nibFile = [NSString stringWithCString:argv[1] encoding:NSUTF8StringEncoding]; 27 | NSFileManager *manager = [NSFileManager defaultManager]; 28 | BOOL isDirectory = NO; 29 | BOOL fileExists = [manager fileExistsAtPath:nibFile isDirectory:&isDirectory]; 30 | if (!fileExists || isDirectory) 31 | { 32 | printf("This utility requires a valid NIB file path as parameter.\n"); 33 | return 0; 34 | } 35 | 36 | // As an optional second parameter, specify whether to use properties or setters 37 | NibProcessorCodeStyle codeStyle = NibProcessorCodeStyleProperties; 38 | 39 | if (argc > 2) 40 | { 41 | int value = atoi(argv[2]); 42 | 43 | if (value == 1 || value == 2) 44 | { 45 | codeStyle = (NibProcessorCodeStyle)value; 46 | } 47 | } 48 | 49 | // Use a Processor instance to generate the source code file 50 | // and redirect the output to the standard output stream 51 | NibProcessor *processor = [[NibProcessor alloc] init]; 52 | processor.codeStyle = codeStyle; 53 | processor.input = nibFile; 54 | [processor process]; 55 | printf([processor.output UTF8String], NULL); 56 | [processor release]; 57 | 58 | } 59 | return 0; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /Command Line/nib2objc/nib2objc-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'nib2objc' target in the 'nib2objc' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Contrib/nibs2objc.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # Rudi Farkas 12 Dec 2009 4 | 5 | # ---------------------------------------------------------------------------- 6 | # "THE BEER-WARE LICENSE" (Revision 42): 7 | # Rudi Farkas wrote this file. As long as you retain this notice you 8 | # can do whatever you want with this stuff. If we meet some day, and you think 9 | # this stuff is worth it, you can buy me a beer in return (Guiness if possible). 10 | # ---------------------------------------------------------------------------- 11 | 12 | 13 | # Searches the Xcode directory and its subdirectories xib files 14 | # for each file yyy.xib creates the corresponding yyy.txt file 15 | # which contains the output from akosma's utility nib2objc which uses ibtool 16 | 17 | # Also replaces variable names matching /view\w+/ by UI-type dependent variable names 18 | # for example "view25" => "tabBarItem25" 19 | 20 | # Requires Mac OSX utility nib2objc from http://github.com/akosma/nib2objc to be installed as /usr/local/bin/nib2objc 21 | 22 | # Version 1.1 23 | # Now using a hash %{$oldtonew} to manage multiple old to new substitutions 24 | 25 | 26 | 27 | my $usage = "$0 "; 28 | 29 | use strict; 30 | use File::Find; 31 | use File::Slurp; 32 | 33 | my $dir = ''; 34 | 35 | my $dir = shift || ''; 36 | die "*** bad directory : '$dir'\nusage: $usage\n\n" unless -d $dir; 37 | 38 | my $nib2objc = "/usr/local/bin/nib2objc"; 39 | 40 | my $nf = 0; 41 | 42 | File::Find::find( { wanted => \&wanted, no_chdir => 1 }, $dir); 43 | 44 | #print "$nf files seen\n"; 45 | 46 | exit; 47 | 48 | 49 | sub wanted { 50 | my $path = $File::Find::name; 51 | return if -d $path; 52 | ++$nf; 53 | if ($path =~ /\.xib$/i) { 54 | nib2objc($path); 55 | } 56 | } 57 | 58 | sub nib2objc { 59 | my $infilepath = shift; 60 | my $outfilepath = $infilepath; 61 | $outfilepath =~ s/\.xib$/.txt/i; 62 | my @output = `$nib2objc $infilepath`; 63 | 64 | printf "$infilepath : file seen (%d lines)\n", 0 + @output; 65 | 66 | my $oldtonew = {}; # ref to empty hash 67 | for (@output) { 68 | # detect a UI var and create substitute 69 | if (my ($uitype, $uivarsuffix) = $_ =~ /^UI(\w+) \*view(\d+) =/) { 70 | my $newuivar = lcfirst $uitype; 71 | $newuivar .= $uivarsuffix; 72 | my $olduivar = "view$uivarsuffix"; 73 | printf " olduivar=%s => newuivar=%s\n", $olduivar, $newuivar; 74 | $oldtonew->{$olduivar} = $newuivar; 75 | } 76 | # use substitutes created so far 77 | for my $olduivar (keys %{$oldtonew}) { 78 | my $newuivar = $oldtonew->{$olduivar}; 79 | if (s/\b$olduivar\b/$newuivar/g) { 80 | #print; 81 | } 82 | } 83 | } 84 | 85 | if (write_file $outfilepath, @output) { 86 | print "$outfilepath : file written\n"; 87 | } 88 | else { 89 | print "$outfilepath : failed to write\n"; 90 | } 91 | 92 | 93 | } 94 | 95 | -------------------------------------------------------------------------------- /GUI/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 7/18/10. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface AppDelegate : NSObject 13 | { 14 | 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /GUI/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 7/18/10. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender 15 | { 16 | return NO; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /GUI/English.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Adrian Kosmaczewski\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Adrian Kosmaczewski\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Adrian Kosmaczewski\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Adrian Kosmaczewski\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Claudia :)\ 29 | } -------------------------------------------------------------------------------- /GUI/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /GUI/MyDocument.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyDocument.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 7/17/10. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | @class MGSFragaria; 13 | @class NibProcessor; 14 | 15 | @interface MyDocument : NSDocument 16 | { 17 | @private 18 | NSView *_editorView; 19 | NSString *_nibCode; 20 | NSString *_fileName; 21 | MGSFragaria *_fragariaEditor; 22 | NibProcessor *_nibProcessor; 23 | NSMatrix *_radioButtonMatrix; 24 | } 25 | 26 | @property (nonatomic, retain) IBOutlet NSView *editorView; 27 | @property (nonatomic, retain) IBOutlet NSMatrix *radioButtonMatrix; 28 | 29 | - (IBAction)changeOutputType:(id)sender; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /GUI/MyDocument.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyDocument.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 7/17/10. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "MyDocument.h" 10 | #import "NibProcessor.h" 11 | #import 12 | 13 | @interface MyDocument () 14 | 15 | @property (nonatomic, copy) NSString *nibCode; 16 | @property (nonatomic, copy) NSString *fileName; 17 | @property (nonatomic, retain) MGSFragaria *fragariaEditor; 18 | @property (nonatomic, retain) NibProcessor *nibProcessor; 19 | 20 | @end 21 | 22 | 23 | 24 | @implementation MyDocument 25 | 26 | @synthesize editorView = _editorView; 27 | @synthesize nibCode = _nibCode; 28 | @synthesize fileName = _fileName; 29 | @synthesize fragariaEditor = _fragariaEditor; 30 | @synthesize nibProcessor = _nibProcessor; 31 | @synthesize radioButtonMatrix = _radioButtonMatrix; 32 | 33 | - (id)init 34 | { 35 | self = [super init]; 36 | if (self) 37 | { 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc 43 | { 44 | [_editorView release]; 45 | _editorView = nil; 46 | [_nibCode release]; 47 | _nibCode = nil; 48 | [_fileName release]; 49 | _fileName = nil; 50 | [_fragariaEditor release]; 51 | _fragariaEditor = nil; 52 | [_nibProcessor release]; 53 | _nibProcessor = nil; 54 | [_radioButtonMatrix release]; 55 | _radioButtonMatrix = nil; 56 | 57 | [super dealloc]; 58 | } 59 | 60 | - (NSString *)windowNibName 61 | { 62 | return @"MyDocument"; 63 | } 64 | 65 | - (void)windowControllerDidLoadNib:(NSWindowController *) aController 66 | { 67 | [super windowControllerDidLoadNib:aController]; 68 | self.fragariaEditor = [[[MGSFragaria alloc] init] autorelease]; 69 | 70 | [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:MGSPrefsAutocompleteSuggestAutomatically]; 71 | [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:NO] forKey:MGSPrefsLineWrapNewDocuments]; 72 | [self.fragariaEditor setObject:[NSNumber numberWithBool:YES] forKey:MGSFOIsSyntaxColoured]; 73 | [self.fragariaEditor setObject:[NSNumber numberWithBool:YES] forKey:MGSFOShowLineNumberGutter]; 74 | [self.fragariaEditor setObject:@"Objective-C" forKey:MGSFOSyntaxDefinitionName]; 75 | [self.fragariaEditor embedInView:self.editorView]; 76 | [self.fragariaEditor setString:self.nibCode]; 77 | 78 | NSTextView *textView = [self.fragariaEditor objectForKey:ro_MGSFOTextView]; 79 | [textView setEditable:NO]; 80 | [textView setFont:[NSFont fontWithName:@"Monaco" size:14.0]]; 81 | } 82 | 83 | - (BOOL)prepareSavePanel:(NSSavePanel *)savePanel 84 | { 85 | [savePanel setAllowedFileTypes:[NSArray arrayWithObjects:@"m", nil]]; 86 | [savePanel setExtensionHidden:NO]; 87 | return YES; 88 | } 89 | 90 | - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError 91 | { 92 | [self.nibCode writeToURL:absoluteURL atomically:YES encoding:NSUTF8StringEncoding error:nil]; 93 | return YES; 94 | } 95 | 96 | - (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)type 97 | { 98 | self.fileName = fileName; 99 | self.nibProcessor = [[[NibProcessor alloc] init] autorelease]; 100 | self.nibProcessor.input = self.fileName; 101 | [self.nibProcessor process]; 102 | self.nibCode = self.nibProcessor.output; 103 | return YES; 104 | } 105 | 106 | #pragma mark - 107 | #pragma mark IBAction methods 108 | 109 | - (IBAction)changeOutputType:(id)sender 110 | { 111 | self.nibProcessor.codeStyle = (NibProcessorCodeStyle)[self.radioButtonMatrix selectedTag]; 112 | [self.nibProcessor process]; 113 | self.nibCode = self.nibProcessor.output; 114 | [self.fragariaEditor setString:@""]; 115 | [self.fragariaEditor setString:self.nibCode]; 116 | } 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /GUI/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 7/17/10. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /GUI/nib2objc-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeExtensions 11 | 12 | xib 13 | 14 | CFBundleTypeIconFile 15 | 16 | CFBundleTypeName 17 | DocumentType 18 | CFBundleTypeOSTypes 19 | 20 | public.data 21 | 22 | CFBundleTypeRole 23 | Editor 24 | NSDocumentClass 25 | MyDocument 26 | 27 | 28 | CFBundleExecutable 29 | ${EXECUTABLE_NAME} 30 | CFBundleIconFile 31 | nib2objc.icns 32 | CFBundleIdentifier 33 | com.akosma.nib2objc 34 | CFBundleInfoDictionaryVersion 35 | 6.0 36 | CFBundleName 37 | ${PRODUCT_NAME} 38 | CFBundlePackageType 39 | APPL 40 | CFBundleSignature 41 | ???? 42 | CFBundleVersion 43 | 1.3 44 | LSMinimumSystemVersion 45 | ${MACOSX_DEPLOYMENT_TARGET} 46 | NSMainNibFile 47 | MainMenu 48 | NSPrincipalClass 49 | NSApplication 50 | 51 | 52 | -------------------------------------------------------------------------------- /GUI/nib2objc.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akosma/nib2objc/cde9b9e8804a93c297681fd1aeed0c56719493f4/GUI/nib2objc.icns -------------------------------------------------------------------------------- /GUI/nib2objc.icns.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akosma/nib2objc/cde9b9e8804a93c297681fd1aeed0c56719493f4/GUI/nib2objc.icns.ai -------------------------------------------------------------------------------- /GUI/nib2objc_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'nib2objc' target in the 'nib2objc' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2009 March 16 2 | 3 | Adrian Kosmaczewski disclaims copyright to this source code. In place of a legal notice, here is a blessing: 4 | 5 | May you do good and not evil. 6 | May you find forgiveness for yourself and forgive others. 7 | May you share freely, never taking more than you give. 8 | 9 | 10 | --- 11 | 12 | The nibs2objc.pl file has the following license: 13 | 14 | ---------------------------------------------------------------------------- 15 | "THE BEER-WARE LICENSE" (Revision 42): 16 | Rudi Farkas wrote this file. As long as you retain this notice you 17 | can do whatever you want with this stuff. If we meet some day, and you think 18 | this stuff is worth it, you can buy me a beer in return (Guiness if possible). 19 | ---------------------------------------------------------------------------- 20 | -------------------------------------------------------------------------------- /NibProcessor/Categories/NSDictionary+Nib2ObjcExtensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+Nib2ObjcExtensions.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import 10 | 11 | @interface NSDictionary (Nib2ObjcExtensions) 12 | 13 | - (NSString *)fontString; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /NibProcessor/Categories/NSDictionary+Nib2ObjcExtensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+Nib2ObjcExtensions.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "NSDictionary+Nib2ObjcExtensions.h" 10 | 11 | @implementation NSDictionary (Nib2ObjcExtensions) 12 | 13 | - (NSString *)fontString 14 | { 15 | NSString *name = [self objectForKey:@"Name"]; 16 | float size = [[self objectForKey:@"Size"] floatValue]; 17 | return [NSString stringWithFormat:@"[UIFont fontWithName:@\"%@\" size:%1.3f]", name, size]; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /NibProcessor/Categories/NSNumber+Nib2ObjcExtensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+Nib2ObjcExtensions.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSNumber (Nib2ObjcExtensions) 13 | 14 | - (NSString *)booleanString; 15 | - (NSString *)intString; 16 | - (NSString *)floatString; 17 | - (NSString *)autoresizingMaskString; 18 | - (NSString *)contentModeString; 19 | - (NSString *)textAlignmentString; 20 | - (NSString *)borderStyleString; 21 | - (NSString *)contentHorizontalAlignmentString; 22 | - (NSString *)contentVerticalAlignmentString; 23 | - (NSString *)keyboardAppearanceString; 24 | - (NSString *)returnKeyTypeString; 25 | - (NSString *)autocapitalizationTypeString; 26 | - (NSString *)autocorrectionTypeString; 27 | - (NSString *)keyboardTypeString; 28 | - (NSString *)progressViewStyleString; 29 | - (NSString *)baselineAdjustmentString; 30 | - (NSString *)lineBreakModeString; 31 | - (NSString *)activityIndicatorViewStyleString; 32 | - (NSString *)buttonTypeString; 33 | - (NSString *)segmentedControlStyleString; 34 | - (NSString *)scrollViewIndicatorStyleString; 35 | - (NSString *)tableViewStyleString; 36 | - (NSString *)tableViewCellSeparatorStyleString; 37 | - (NSString *)tableViewCellAccessoryString; 38 | - (NSString *)tableViewCellEditingStyleString; 39 | - (NSString *)tableViewCellSelectionStyleString; 40 | - (NSString *)datePickerModeString; 41 | - (NSString *)barStyleString; 42 | - (NSString *)barButtonItemStyleString; 43 | - (NSString *)barButtonSystemItemString; 44 | - (NSString *)tabBarSystemItemString; 45 | - (NSString *)mapTypeString; 46 | - (NSString *)clearButtonModeString; 47 | - (NSString *)swipeGestureRecognizerDirectionString; 48 | - (NSString *)modalPresentationStyleString; 49 | - (NSString *)modalTransitionStyleString; 50 | - (NSString *)drawableColorFormatString; 51 | - (NSString *)drawableDepthFormatString; 52 | - (NSString *)drawableMultisampleString; 53 | - (NSString *)drawableStencilFormatString; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /NibProcessor/Categories/NSNumber+Nib2ObjcExtensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+Nib2ObjcExtensions.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "NSNumber+Nib2ObjcExtensions.h" 10 | 11 | @implementation NSNumber (Nib2ObjcExtensions) 12 | 13 | - (NSString *)booleanString 14 | { 15 | return ([self boolValue] == 1) ? @"YES" : @"NO"; 16 | } 17 | 18 | - (NSString *)intString 19 | { 20 | return [NSString stringWithFormat:@"%d", [self intValue]]; 21 | } 22 | 23 | - (NSString *)floatString 24 | { 25 | return [NSString stringWithFormat:@"%1.3f", [self floatValue]]; 26 | } 27 | 28 | - (NSString *)autoresizingMaskString 29 | { 30 | // From the documentation 31 | enum 32 | { 33 | UIViewAutoresizingNone = 0, 34 | UIViewAutoresizingFlexibleLeftMargin = 1 << 0, 35 | UIViewAutoresizingFlexibleWidth = 1 << 1, 36 | UIViewAutoresizingFlexibleRightMargin = 1 << 2, 37 | UIViewAutoresizingFlexibleTopMargin = 1 << 3, 38 | UIViewAutoresizingFlexibleHeight = 1 << 4, 39 | UIViewAutoresizingFlexibleBottomMargin = 1 << 5 40 | }; 41 | 42 | NSUInteger mask = [self intValue]; 43 | NSMutableString *maskValue = [[[NSMutableString alloc] init] autorelease]; 44 | 45 | if (mask == UIViewAutoresizingNone) 46 | { 47 | [maskValue appendString:@"UIViewAutoresizingNone"]; 48 | } 49 | if ((mask & UIViewAutoresizingFlexibleLeftMargin) == UIViewAutoresizingFlexibleLeftMargin) 50 | { 51 | if ([maskValue length] > 0) [maskValue appendString:@" | "]; 52 | [maskValue appendString:@"UIViewAutoresizingFlexibleLeftMargin"]; 53 | } 54 | if ((mask & UIViewAutoresizingFlexibleWidth) == UIViewAutoresizingFlexibleWidth) 55 | { 56 | if ([maskValue length] > 0) [maskValue appendString:@" | "]; 57 | [maskValue appendString:@"UIViewAutoresizingFlexibleWidth"]; 58 | } 59 | if ((mask & UIViewAutoresizingFlexibleRightMargin) == UIViewAutoresizingFlexibleRightMargin) 60 | { 61 | if ([maskValue length] > 0) [maskValue appendString:@" | "]; 62 | [maskValue appendString:@"UIViewAutoresizingFlexibleRightMargin"]; 63 | } 64 | if ((mask & UIViewAutoresizingFlexibleTopMargin) == UIViewAutoresizingFlexibleTopMargin) 65 | { 66 | if ([maskValue length] > 0) [maskValue appendString:@" | "]; 67 | [maskValue appendString:@"UIViewAutoresizingFlexibleTopMargin"]; 68 | } 69 | if ((mask & UIViewAutoresizingFlexibleHeight) == UIViewAutoresizingFlexibleHeight) 70 | { 71 | if ([maskValue length] > 0) [maskValue appendString:@" | "]; 72 | [maskValue appendString:@"UIViewAutoresizingFlexibleHeight"]; 73 | } 74 | if ((mask & UIViewAutoresizingFlexibleBottomMargin) == UIViewAutoresizingFlexibleBottomMargin) 75 | { 76 | if ([maskValue length] > 0) [maskValue appendString:@" | "]; 77 | [maskValue appendString:@"UIViewAutoresizingFlexibleBottomMargin"]; 78 | } 79 | 80 | return maskValue; 81 | } 82 | 83 | - (NSString *)contentModeString 84 | { 85 | NSArray *values = [NSArray arrayWithObjects:@"UIViewContentModeScaleToFill", 86 | @"UIViewContentModeScaleAspectFit", 87 | @"UIViewContentModeScaleAspectFill", 88 | @"UIViewContentModeRedraw", 89 | @"UIViewContentModeCenter", 90 | @"UIViewContentModeTop", 91 | @"UIViewContentModeBottom", 92 | @"UIViewContentModeLeft", 93 | @"UIViewContentModeRight", 94 | @"UIViewContentModeTopLeft", 95 | @"UIViewContentModeTopRight", 96 | @"UIViewContentModeBottomLeft", 97 | @"UIViewContentModeBottomRight", nil]; 98 | return [values objectAtIndex:[self intValue]]; 99 | } 100 | 101 | - (NSString *)textAlignmentString 102 | { 103 | NSArray *values = [NSArray arrayWithObjects:@"UITextAlignmentLeft", 104 | @"UITextAlignmentCenter", 105 | @"UITextAlignmentRight", nil]; 106 | return [values objectAtIndex:[self intValue]]; 107 | } 108 | 109 | - (NSString *)borderStyleString 110 | { 111 | NSArray *values = [NSArray arrayWithObjects:@"UITextBorderStyleNone", 112 | @"UITextBorderStyleLine", 113 | @"UITextBorderStyleBezel", 114 | @"UITextBorderStyleRoundedRect", nil]; 115 | return [values objectAtIndex:[self intValue]]; 116 | } 117 | 118 | - (NSString *)contentHorizontalAlignmentString 119 | { 120 | NSArray *values = [NSArray arrayWithObjects:@"UIControlContentHorizontalAlignmentCenter", 121 | @"UIControlContentHorizontalAlignmentLeft", 122 | @"UIControlContentHorizontalAlignmentRight", 123 | @"UIControlContentHorizontalAlignmentFill", nil]; 124 | return [values objectAtIndex:[self intValue]]; 125 | } 126 | 127 | - (NSString *)contentVerticalAlignmentString 128 | { 129 | NSArray *values = [NSArray arrayWithObjects:@"UIControlContentVerticalAlignmentCenter", 130 | @"UIControlContentVerticalAlignmentTop", 131 | @"UIControlContentVerticalAlignmentBottom", 132 | @"UIControlContentVerticalAlignmentFill", nil]; 133 | return [values objectAtIndex:[self intValue]]; 134 | } 135 | 136 | - (NSString *)keyboardAppearanceString 137 | { 138 | NSArray *values = [NSArray arrayWithObjects:@"UIKeyboardAppearanceDefault", 139 | @"UIKeyboardAppearanceAlert", nil]; 140 | return [values objectAtIndex:[self intValue]]; 141 | } 142 | 143 | - (NSString *)returnKeyTypeString 144 | { 145 | NSArray *values = [NSArray arrayWithObjects:@"UIReturnKeyDefault", 146 | @"UIReturnKeyGo", 147 | @"UIReturnKeyGoogle", 148 | @"UIReturnKeyJoin", 149 | @"UIReturnKeyNext", 150 | @"UIReturnKeyRoute", 151 | @"UIReturnKeySearch", 152 | @"UIReturnKeySend", 153 | @"UIReturnKeyYahoo", 154 | @"UIReturnKeyDone", 155 | @"UIReturnKeyEmergencyCall", nil]; 156 | return [values objectAtIndex:[self intValue]]; 157 | } 158 | 159 | - (NSString *)autocapitalizationTypeString 160 | { 161 | NSArray *values = [NSArray arrayWithObjects:@"UITextAutocapitalizationTypeNone", 162 | @"UITextAutocapitalizationTypeWords", 163 | @"UITextAutocapitalizationTypeSentences", 164 | @"UITextAutocapitalizationTypeAllCharacters", nil]; 165 | return [values objectAtIndex:[self intValue]]; 166 | } 167 | 168 | - (NSString *)autocorrectionTypeString 169 | { 170 | NSArray *values = [NSArray arrayWithObjects:@"UITextAutocorrectionTypeDefault", 171 | @"UITextAutocorrectionTypeNo", 172 | @"UITextAutocorrectionTypeYes", nil]; 173 | return [values objectAtIndex:[self intValue]]; 174 | } 175 | 176 | - (NSString *)keyboardTypeString 177 | { 178 | NSArray *values = [NSArray arrayWithObjects:@"UIKeyboardTypeDefault", 179 | @"UIKeyboardTypeASCIICapable", 180 | @"UIKeyboardTypeNumbersAndPunctuation", 181 | @"UIKeyboardTypeURL", 182 | @"UIKeyboardTypeNumberPad", 183 | @"UIKeyboardTypePhonePad", 184 | @"UIKeyboardTypeNamePhonePad", 185 | @"UIKeyboardTypeEmailAddress", nil]; 186 | return [values objectAtIndex:[self intValue]]; 187 | } 188 | 189 | - (NSString *)progressViewStyleString 190 | { 191 | NSArray *values = [NSArray arrayWithObjects:@"UIProgressViewStyleDefault", 192 | @"UIProgressViewStyleBar", nil]; 193 | return [values objectAtIndex:[self intValue]]; 194 | } 195 | 196 | - (NSString *)baselineAdjustmentString 197 | { 198 | NSArray *values = [NSArray arrayWithObjects:@"UIBaselineAdjustmentAlignBaselines", 199 | @"UIBaselineAdjustmentAlignCenters", 200 | @"UIBaselineAdjustmentNone", nil]; 201 | return [values objectAtIndex:[self intValue]]; 202 | } 203 | 204 | - (NSString *)lineBreakModeString 205 | { 206 | NSArray *values = [NSArray arrayWithObjects:@"UILineBreakModeWordWrap", 207 | @"UILineBreakModeCharacterWrap", 208 | @"UILineBreakModeClip", 209 | @"UILineBreakModeHeadTruncation", 210 | @"UILineBreakModeTailTruncation", 211 | @"UILineBreakModeMiddleTruncation", nil]; 212 | return [values objectAtIndex:[self intValue]]; 213 | } 214 | 215 | - (NSString *)activityIndicatorViewStyleString 216 | { 217 | NSArray *values = [NSArray arrayWithObjects:@"UIActivityIndicatorViewStyleWhiteLarge", 218 | @"UIActivityIndicatorViewStyleWhite", 219 | @"UIActivityIndicatorViewStyleGray", nil]; 220 | return [values objectAtIndex:[self intValue]]; 221 | } 222 | 223 | - (NSString *)buttonTypeString 224 | { 225 | NSArray *values = [NSArray arrayWithObjects:@"UIButtonTypeCustom", 226 | @"UIButtonTypeRoundedRect", 227 | @"UIButtonTypeDetailDisclosure", 228 | @"UIButtonTypeInfoLight", 229 | @"UIButtonTypeInfoDark", 230 | @"UIButtonTypeContactAdd", nil]; 231 | return [values objectAtIndex:[self intValue]]; 232 | } 233 | 234 | - (NSString *)segmentedControlStyleString 235 | { 236 | NSArray *values = [NSArray arrayWithObjects:@"UISegmentedControlStylePlain", 237 | @"UISegmentedControlStyleBordered", 238 | @"UISegmentedControlStyleBar", nil]; 239 | return [values objectAtIndex:[self intValue]]; 240 | } 241 | 242 | - (NSString *)scrollViewIndicatorStyleString 243 | { 244 | NSArray *values = [NSArray arrayWithObjects:@"UIScrollViewIndicatorStyleDefault", 245 | @"UIScrollViewIndicatorStyleBlack", 246 | @"UIScrollViewIndicatorStyleWhite", nil]; 247 | return [values objectAtIndex:[self intValue]]; 248 | } 249 | 250 | - (NSString *)tableViewStyleString 251 | { 252 | NSArray *values = [NSArray arrayWithObjects:@"UITableViewStylePlain", 253 | @"UITableViewStyleGrouped", nil]; 254 | return [values objectAtIndex:[self intValue]]; 255 | } 256 | 257 | - (NSString *)tableViewCellSeparatorStyleString 258 | { 259 | NSArray *values = [NSArray arrayWithObjects:@"UITableViewCellSeparatorStyleNone", 260 | @"UITableViewCellSeparatorStyleSingleLine", 261 | @"UITableViewCellSeparatorStyleSingleLineEtched", nil]; 262 | return [values objectAtIndex:[self intValue]]; 263 | } 264 | 265 | - (NSString *)tableViewCellAccessoryString 266 | { 267 | NSArray *values = [NSArray arrayWithObjects:@"UITableViewCellAccessoryNone", 268 | @"UITableViewCellAccessoryDisclosureIndicator", 269 | @"UITableViewCellAccessoryDetailDisclosureButton", 270 | @"UITableViewCellAccessoryCheckmark", nil]; 271 | return [values objectAtIndex:[self intValue]]; 272 | } 273 | 274 | - (NSString *)tableViewCellEditingStyleString 275 | { 276 | NSArray *values = [NSArray arrayWithObjects:@"UITableViewCellEditingStyleNone", 277 | @"UITableViewCellEditingStyleDelete", 278 | @"UITableViewCellEditingStyleInsert", nil]; 279 | return [values objectAtIndex:[self intValue]]; 280 | } 281 | 282 | - (NSString *)tableViewCellSelectionStyleString 283 | { 284 | NSArray *values = [NSArray arrayWithObjects:@"UITableViewCellSelectionStyleNone", 285 | @"UITableViewCellSelectionStyleBlue", 286 | @"UITableViewCellSelectionStyleGray", nil]; 287 | return [values objectAtIndex:[self intValue]]; 288 | } 289 | 290 | - (NSString *)datePickerModeString 291 | { 292 | NSArray *values = [NSArray arrayWithObjects:@"UIDatePickerModeTime", 293 | @"UIDatePickerModeDate", 294 | @"UIDatePickerModeDateAndTime", 295 | @"UIDatePickerModeCountDownTimer", nil]; 296 | return [values objectAtIndex:[self intValue]]; 297 | } 298 | 299 | - (NSString *)barStyleString 300 | { 301 | NSArray *values = [NSArray arrayWithObjects:@"UIBarStyleDefault", 302 | @"UIBarStyleBlackOpaque", 303 | @"UIBarStyleBlackTranslucent", nil]; 304 | return [values objectAtIndex:[self intValue]]; 305 | } 306 | 307 | - (NSString *)barButtonItemStyleString 308 | { 309 | NSArray *values = [NSArray arrayWithObjects:@"UIBarButtonItemStylePlain", 310 | @"UIBarButtonItemStyleBordered", 311 | @"UIBarButtonItemStyleDone", nil]; 312 | return [values objectAtIndex:[self intValue]]; 313 | } 314 | 315 | - (NSString *)barButtonSystemItemString 316 | { 317 | NSArray *values = [NSArray arrayWithObjects:@"UIBarButtonSystemItemDone", 318 | @"UIBarButtonSystemItemCancel", 319 | @"UIBarButtonSystemItemEdit", 320 | @"UIBarButtonSystemItemSave", 321 | @"UIBarButtonSystemItemAdd", 322 | @"UIBarButtonSystemItemFlexibleSpace", 323 | @"UIBarButtonSystemItemFixedSpace", 324 | @"UIBarButtonSystemItemCompose", 325 | @"UIBarButtonSystemItemReply", 326 | @"UIBarButtonSystemItemAction", 327 | @"UIBarButtonSystemItemOrganize", 328 | @"UIBarButtonSystemItemBookmarks", 329 | @"UIBarButtonSystemItemSearch", 330 | @"UIBarButtonSystemItemRefresh", 331 | @"UIBarButtonSystemItemStop", 332 | @"UIBarButtonSystemItemCamera", 333 | @"UIBarButtonSystemItemTrash", 334 | @"UIBarButtonSystemItemPlay", 335 | @"UIBarButtonSystemItemPause", 336 | @"UIBarButtonSystemItemRewind", 337 | @"UIBarButtonSystemItemFastForward", nil]; 338 | return [values objectAtIndex:[self intValue]]; 339 | } 340 | 341 | - (NSString *)tabBarSystemItemString 342 | { 343 | NSArray *values = [NSArray arrayWithObjects:@"UITabBarSystemItemMore", 344 | @"UITabBarSystemItemFavorites", 345 | @"UITabBarSystemItemFeatured", 346 | @"UITabBarSystemItemTopRated", 347 | @"UITabBarSystemItemRecents", 348 | @"UITabBarSystemItemContacts", 349 | @"UITabBarSystemItemHistory", 350 | @"UITabBarSystemItemBookmarks", 351 | @"UITabBarSystemItemSearch", 352 | @"UITabBarSystemItemDownloads", 353 | @"UITabBarSystemItemMostRecent", 354 | @"UITabBarSystemItemMostViewed", nil]; 355 | return [values objectAtIndex:[self intValue]]; 356 | } 357 | 358 | - (NSString *)mapTypeString 359 | { 360 | NSArray *values = [NSArray arrayWithObjects:@"MKMapTypeStandard", 361 | @"MKMapTypeSatellite", 362 | @"MKMapTypeHybrid", nil]; 363 | return [values objectAtIndex:[self intValue]]; 364 | } 365 | 366 | - (NSString *)clearButtonModeString 367 | { 368 | NSArray *values = [NSArray arrayWithObjects:@"UITextFieldViewModeNever", 369 | @"UITextFieldViewModeWhileEditing", 370 | @"UITextFieldViewModeUnlessEditing", 371 | @"UITextFieldViewModeAlways", nil]; 372 | return [values objectAtIndex:[self intValue]]; 373 | } 374 | 375 | - (NSString *)swipeGestureRecognizerDirectionString 376 | { 377 | NSArray *values = [NSArray arrayWithObjects:@"UISwipeGestureRecognizerDirectionRight", 378 | @"UISwipeGestureRecognizerDirectionLeft", 379 | @"UISwipeGestureRecognizerDirectionUp", 380 | @"UISwipeGestureRecognizerDirectionDown", nil]; 381 | return [values objectAtIndex:[self intValue]]; 382 | } 383 | 384 | - (NSString *)modalPresentationStyleString 385 | { 386 | NSArray *values = [NSArray arrayWithObjects:@"UIModalPresentationFullScreen", 387 | @"UIModalPresentationPageSheet", 388 | @"UIModalPresentationFormSheet", 389 | @"UIModalPresentationCurrentContext", nil]; 390 | return [values objectAtIndex:[self intValue]]; 391 | } 392 | 393 | - (NSString *)modalTransitionStyleString 394 | { 395 | NSArray *values = [NSArray arrayWithObjects:@"UIModalTransitionStyleCoverVertical", 396 | @"UIModalTransitionStyleFlipHorizontal", 397 | @"UIModalTransitionStyleCrossDissolve", 398 | @"UIModalTransitionStylePartialCurl", nil]; 399 | return [values objectAtIndex:[self intValue]]; 400 | } 401 | 402 | - (NSString *)drawableColorFormatString 403 | { 404 | NSArray *values = [NSArray arrayWithObjects:@"GLKViewDrawableColorFormatRGBA8888", 405 | @"GLKViewDrawableColorFormatRGB565", nil]; 406 | return [values objectAtIndex:[self intValue]]; 407 | } 408 | 409 | - (NSString *)drawableDepthFormatString 410 | { 411 | NSArray *values = [NSArray arrayWithObjects:@"GLKViewDrawableDepthFormatNone", 412 | @"GLKViewDrawableDepthFormat16", 413 | @"GLKViewDrawableDepthFormat24", nil]; 414 | return [values objectAtIndex:[self intValue]]; 415 | } 416 | 417 | - (NSString *)drawableMultisampleString 418 | { 419 | NSArray *values = [NSArray arrayWithObjects:@"GLKViewDrawableMultisampleNone", 420 | @"GLKViewDrawableMultisample4X", nil]; 421 | return [values objectAtIndex:[self intValue]]; 422 | } 423 | 424 | - (NSString *)drawableStencilFormatString 425 | { 426 | NSArray *values = [NSArray arrayWithObjects:@"GLKViewDrawableStencilFormatNone", 427 | @"GLKViewDrawableStencilFormatNone", nil]; 428 | return [values objectAtIndex:[self intValue]]; 429 | } 430 | 431 | @end 432 | -------------------------------------------------------------------------------- /NibProcessor/Categories/NSString+Nib2ObjcExtensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Nib2ObjcExtensions.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (Nib2ObjcExtensions) 12 | 13 | + (NSString *)rectStringFromPoint:(NSString *)pointString size:(NSString *)sizeString; 14 | + (NSString *)dateFromStringFunction; 15 | - (NSString *)sizeString; 16 | - (NSString *)colorString; 17 | - (NSString *)quotedAsCodeString; 18 | - (NSString *)capitalize; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /NibProcessor/Categories/NSString+Nib2ObjcExtensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Nib2ObjcExtensions.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "NSString+Nib2ObjcExtensions.h" 10 | 11 | @implementation NSString (Nib2ObjcExtensions) 12 | 13 | + (NSString *)rectStringFromPoint:(NSString *)pointString size:(NSString *)sizeString 14 | { 15 | NSPoint point = NSPointFromString(pointString); 16 | NSSize size = NSSizeFromString(sizeString); 17 | return [NSString stringWithFormat:@"CGRectMake(%1.1f, %1.1f, %1.1f, %1.1f)", point.x, point.y, size.width, size.height]; 18 | } 19 | 20 | + (NSString *)dateFromStringFunction 21 | { 22 | NSMutableString *function = [[[NSMutableString alloc] init] autorelease]; 23 | [function appendString:@"NSDate *dateFromString(NSString *input)\n"]; 24 | [function appendString:@"{\n"]; 25 | [function appendString:@" NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];\n"]; 26 | [function appendString:@" [formatter setDateStyle:NSDateFormatterFullStyle];\n"]; 27 | [function appendString:@" [formatter setTimeStyle:NSDateFormatterFullStyle];\n"]; 28 | [function appendString:@" NSDate *date = [formatter dateFromString:input];\n"]; 29 | [function appendString:@" return date;\n"]; 30 | [function appendString:@"}\n"]; 31 | return function; 32 | } 33 | 34 | - (NSString *)sizeString 35 | { 36 | NSSize size = NSSizeFromString(self); 37 | return [NSString stringWithFormat:@"CGSizeMake(%1.1f, %1.1f)", size.width, size.height]; 38 | } 39 | 40 | - (NSString *)colorString 41 | { 42 | NSMutableString *color = [[[NSMutableString alloc] init] autorelease]; 43 | if ([self hasPrefix:@"NSCalibratedRGBColorSpace"]) 44 | { 45 | float red, green, blue, alpha; 46 | sscanf([self UTF8String], "NSCalibratedRGBColorSpace %f %f %f %f", &red, &green, &blue, &alpha); 47 | [color appendFormat:@"[UIColor colorWithRed:%1.3f green:%1.3f blue:%1.3f alpha:%1.3f]", red, green, blue, alpha]; 48 | } 49 | else if ([self hasPrefix:@"NSCustomColorSpace Generic Gray colorspace "]) 50 | { 51 | float gray, alpha; 52 | sscanf([self UTF8String], "NSCustomColorSpace Generic Gray colorspace %f %f", &gray, &alpha); 53 | [color appendFormat:@"[UIColor colorWithWhite:%1.3f alpha:%1.3f]", gray, alpha]; 54 | } 55 | else if ([self hasPrefix:@"NSCalibratedWhiteColorSpace"]) 56 | { 57 | float gray, alpha; 58 | sscanf([self UTF8String], "NSCalibratedWhiteColorSpace %f %f", &gray, &alpha); 59 | [color appendFormat:@"[UIColor colorWithWhite:%1.3f alpha:%1.3f]", gray, alpha]; 60 | } 61 | else if ([self hasPrefix:@"NSCustomColorSpace Generic CMYK colorspace "]) 62 | { 63 | float cyan, magenta, yellow, black, alpha; 64 | sscanf([self UTF8String], "NSCustomColorSpace Generic CMYK colorspace %f %f %f %f %f", &cyan, &magenta, &yellow, &black, &alpha); 65 | // There is no method in UIColor for CMYK colors... 66 | [color appendFormat:@"[UIColor colorWithCGColor:CGColorCreate(kCGColorSpaceGenericCMYK, {%1.3f, %1.3f, %1.3f, %1.3f, %1.3f})]", cyan, magenta, yellow, black, alpha]; 67 | } 68 | else 69 | { 70 | [color appendString:self]; 71 | } 72 | return color; 73 | } 74 | 75 | - (NSString *)quotedAsCodeString 76 | { 77 | return [NSString stringWithFormat:@"@\"%@\"", self]; 78 | } 79 | 80 | - (NSString *)capitalize 81 | { 82 | // Adapted from 83 | // http://stackoverflow.com/questions/2432452/how-to-capitalize-the-first-word-of-the-sentece-in-objective-c 84 | return [self stringByReplacingCharactersInRange:NSMakeRange(0,1) 85 | withString:[[self substringToIndex:1] uppercaseString]]; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /NibProcessor/NibProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // NibProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/13/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | NibProcessorCodeStyleProperties = 1, 13 | NibProcessorCodeStyleSetter = 2 14 | } NibProcessorCodeStyle; 15 | 16 | @interface NibProcessor : NSObject 17 | { 18 | @private 19 | NSDictionary *_dictionary; 20 | NSMutableString *_output; 21 | NSMutableData *_data; 22 | NSString *_filename; 23 | NibProcessorCodeStyle _codeStyle; 24 | } 25 | 26 | @property (nonatomic, copy) NSString *input; 27 | @property (nonatomic, readonly) NSString *output; 28 | @property (nonatomic) NibProcessorCodeStyle codeStyle; 29 | 30 | - (void)process; 31 | 32 | - (NSString *)inputAsText; 33 | - (NSDictionary *)inputAsDictionary; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /NibProcessor/NibProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // NibProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/13/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "NibProcessor.h" 10 | #import "Processor.h" 11 | #import "NSString+Nib2ObjcExtensions.h" 12 | 13 | @interface NibProcessor () 14 | 15 | - (void)getDictionaryFromNIB; 16 | - (void)parseChildren:(NSDictionary *)dict ofCurrentView:(int)currentView withObjects:(NSDictionary *)objects; 17 | - (NSString *)instanceNameForObject:(id)obj; 18 | 19 | @end 20 | 21 | 22 | @implementation NibProcessor 23 | 24 | @dynamic input; 25 | @synthesize output = _output; 26 | @synthesize codeStyle = _codeStyle; 27 | 28 | - (id)init 29 | { 30 | if (self = [super init]) 31 | { 32 | self.codeStyle = NibProcessorCodeStyleProperties; 33 | } 34 | return self; 35 | } 36 | 37 | - (void)dealloc 38 | { 39 | [_filename release]; 40 | [_output release]; 41 | [_dictionary release]; 42 | [_data release]; 43 | [super dealloc]; 44 | } 45 | 46 | #pragma mark - 47 | #pragma mark Properties 48 | 49 | - (NSString *)input 50 | { 51 | return _filename; 52 | } 53 | 54 | - (void)setInput:(NSString *)newFilename 55 | { 56 | [_filename release]; 57 | _filename = nil; 58 | _filename = [newFilename copy]; 59 | [self getDictionaryFromNIB]; 60 | } 61 | 62 | - (NSString *)inputAsText 63 | { 64 | return [[[NSString alloc] initWithData:_data encoding:NSUTF8StringEncoding] autorelease]; 65 | } 66 | 67 | - (NSDictionary *)inputAsDictionary 68 | { 69 | NSString *errorStr = nil; 70 | NSPropertyListFormat format; 71 | NSDictionary *propertyList = [NSPropertyListSerialization propertyListFromData:_data 72 | mutabilityOption:NSPropertyListImmutable 73 | format:&format 74 | errorDescription:&errorStr]; 75 | [errorStr release]; 76 | return propertyList; 77 | } 78 | 79 | #pragma mark - 80 | #pragma mark Private methods 81 | 82 | - (void)getDictionaryFromNIB 83 | { 84 | // Build the NSTask that will run the ibtool utility 85 | NSArray *arguments = [NSArray arrayWithObjects:_filename, @"--objects", 86 | @"--hierarchy", @"--connections", @"--classes", nil]; 87 | NSTask *task = [[NSTask alloc] init]; 88 | NSPipe *pipe = [NSPipe pipe]; 89 | NSFileHandle *readHandle = [pipe fileHandleForReading]; 90 | NSData *temp = nil; 91 | 92 | [_data release]; 93 | _data = [[NSMutableData alloc] init]; 94 | 95 | [task setLaunchPath:@"/usr/bin/ibtool"]; 96 | [task setArguments:arguments]; 97 | [task setStandardOutput:pipe]; 98 | [task launch]; 99 | 100 | while ((temp = [readHandle availableData]) && [temp length]) 101 | { 102 | [_data appendData:temp]; 103 | } 104 | 105 | // This dictionary is ready to be parsed, and it contains 106 | // everything we need from the NIB file. 107 | _dictionary = [[self inputAsDictionary] retain]; 108 | 109 | [task release]; 110 | } 111 | 112 | - (void)process 113 | { 114 | // NSDictionary *nibClasses = [dict objectForKey:@"com.apple.ibtool.document.classes"]; 115 | // NSDictionary *nibConnections = [dict objectForKey:@"com.apple.ibtool.document.connections"]; 116 | NSDictionary *nibObjects = [_dictionary objectForKey:@"com.apple.ibtool.document.objects"]; 117 | NSMutableDictionary *objects = [[NSMutableDictionary alloc] init]; 118 | 119 | for (NSDictionary *key in nibObjects) 120 | { 121 | id object = [nibObjects objectForKey:key]; 122 | NSString *klass = [object objectForKey:@"class"]; 123 | 124 | Processor *processor = [Processor processorForClass:klass]; 125 | 126 | if (processor == nil) 127 | { 128 | #ifdef CONFIGURATION_Debug 129 | // Get notified about classes not yet handled by this utility 130 | NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; 131 | [dict setObject:klass forKey:@"// unknown object (yet)"]; 132 | [objects setObject:dict forKey:key]; 133 | [dict release]; 134 | #endif 135 | } 136 | else 137 | { 138 | NSDictionary *dict = [processor processObject:object]; 139 | [objects setObject:dict forKey:key]; 140 | } 141 | } 142 | 143 | // Let's print everything as source code 144 | [_output release]; 145 | _output = [[NSMutableString alloc] init]; 146 | for (NSString *identifier in objects) 147 | { 148 | id object = [objects objectForKey:identifier]; 149 | NSString *identifierKey = [[identifier stringByReplacingOccurrencesOfString:@"-" withString:@""] lowercaseString]; 150 | 151 | // First, output any helper functions, ordered alphabetically 152 | NSArray *orderedKeys = [object keysSortedByValueUsingSelector:@selector(caseInsensitiveCompare:)]; 153 | for (NSString *key in orderedKeys) 154 | { 155 | id value = [object objectForKey:key]; 156 | if ([key hasPrefix:@"__helper__"]) 157 | { 158 | [_output appendString:value]; 159 | [_output appendString:@"\n"]; 160 | } 161 | } 162 | 163 | // Then, output the constructor 164 | id klass = [object objectForKey:@"class"]; 165 | id constructor = [object objectForKey:@"constructor"]; 166 | NSString *instanceName = [self instanceNameForObject:object]; 167 | [_output appendFormat:@"%@ *%@%@ = %@;\n", klass, instanceName, identifierKey, constructor]; 168 | 169 | // Then, output the properties only, ordered alphabetically 170 | orderedKeys = [[object allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; 171 | for (NSString *key in orderedKeys) 172 | { 173 | id value = [object objectForKey:key]; 174 | if (![key hasPrefix:@"__method__"] 175 | && ![key isEqualToString:@"constructor"] && ![key isEqualToString:@"class"] 176 | && ![key hasPrefix:@"__helper__"]) 177 | { 178 | switch (self.codeStyle) 179 | { 180 | case NibProcessorCodeStyleProperties: 181 | [_output appendFormat:@"%@%@.%@ = %@;\n", instanceName, identifierKey, key, value]; 182 | break; 183 | 184 | case NibProcessorCodeStyleSetter: 185 | [_output appendFormat:@"[%@%@ set%@:%@];\n", instanceName, identifierKey, [key capitalize], value]; 186 | break; 187 | 188 | default: 189 | break; 190 | } 191 | } 192 | } 193 | 194 | // Finally, output the method calls, ordered alphabetically 195 | orderedKeys = [object keysSortedByValueUsingSelector:@selector(caseInsensitiveCompare:)]; 196 | for (NSString *key in orderedKeys) 197 | { 198 | id value = [object objectForKey:key]; 199 | if ([key hasPrefix:@"__method__"]) 200 | { 201 | [_output appendFormat:@"[%@%@ %@];\n", instanceName, identifierKey, value]; 202 | } 203 | } 204 | [_output appendString:@"\n"]; 205 | } 206 | 207 | // Now that the objects are created, recreate the hierarchy of the NIB 208 | NSArray *nibHierarchy = [_dictionary objectForKey:@"com.apple.ibtool.document.hierarchy"]; 209 | for (NSDictionary *item in nibHierarchy) 210 | { 211 | int currentView = [[item objectForKey:@"object-id"] intValue]; 212 | [self parseChildren:item ofCurrentView:currentView withObjects:objects]; 213 | } 214 | 215 | [objects release]; 216 | objects = nil; 217 | } 218 | 219 | - (void)parseChildren:(NSDictionary *)dict ofCurrentView:(int)currentView withObjects:(NSDictionary *)objects 220 | { 221 | NSArray *children = [dict objectForKey:@"children"]; 222 | if (children != nil) 223 | { 224 | for (NSDictionary *subitem in children) 225 | { 226 | int subview = [[subitem objectForKey:@"object-id"] intValue]; 227 | 228 | id currentViewObject = [objects objectForKey:[NSString stringWithFormat:@"%d", currentView]]; 229 | NSString *instanceName = [self instanceNameForObject:currentViewObject]; 230 | 231 | id subViewObject = [objects objectForKey:[NSString stringWithFormat:@"%d", subview]]; 232 | NSString *subInstanceName = [self instanceNameForObject:subViewObject]; 233 | 234 | [self parseChildren:subitem ofCurrentView:subview withObjects:objects]; 235 | [_output appendFormat:@"[%@%d addSubview:%@%d];\n", instanceName, currentView, subInstanceName, subview]; 236 | } 237 | } 238 | } 239 | 240 | - (NSString *)instanceNameForObject:(id)obj 241 | { 242 | id klass = [obj objectForKey:@"class"]; 243 | NSString *instanceName = [[klass lowercaseString] substringFromIndex:2]; 244 | return instanceName; 245 | } 246 | 247 | @end 248 | -------------------------------------------------------------------------------- /NibProcessor/Processors/GLKViewControllerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // GLKViewControllerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIViewControllerProcessor.h" 10 | 11 | @interface GLKViewControllerProcessor : UIViewControllerProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/GLKViewControllerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // GLKViewControllerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "GLKViewControllerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation GLKViewControllerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"GLKViewController"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"pauseOnWillResignActive"]) 27 | { 28 | [output setObject:[value booleanString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"preferredFramesPerSecond"]) 31 | { 32 | [output setObject:[value intString] forKey:item]; 33 | } 34 | else if ([item isEqualToString:@"resumeOnDidBecomeActive"]) 35 | { 36 | [output setObject:[value booleanString] forKey:item]; 37 | } 38 | else 39 | { 40 | [super processKey:item value:value]; 41 | } 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /NibProcessor/Processors/GLKViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // GLKViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface GLKViewProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/GLKViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // GLKViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "GLKViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation GLKViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"GLKView"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"drawableColorFormat"]) 27 | { 28 | [output setObject:[value drawableColorFormatString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"drawableDepthFormat"]) 31 | { 32 | [output setObject:[value drawableDepthFormatString] forKey:item]; 33 | } 34 | else if ([item isEqualToString:@"drawableMultisample"]) 35 | { 36 | [output setObject:[value drawableMultisampleString] forKey:item]; 37 | } 38 | else if ([item isEqualToString:@"drawableStencilFormat"]) 39 | { 40 | [output setObject:[value drawableStencilFormatString] forKey:item]; 41 | } 42 | else if ([item isEqualToString:@"enableSetNeedsDisplay"]) 43 | { 44 | [output setObject:[value booleanString] forKey:item]; 45 | } 46 | else 47 | { 48 | [super processKey:item value:value]; 49 | } 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /NibProcessor/Processors/MKMapViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // MKMapViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 7/17/10. 6 | // Adrian Kosmaczewski 2010 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface MKMapViewProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/MKMapViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // MKMapViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 7/17/10. 6 | // Adrian Kosmaczewski 2010 7 | // 8 | 9 | #import "MKMapViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation MKMapViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"MKMapView"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"showsUserLocation"]) 27 | { 28 | [output setObject:[value booleanString] forKey:item]; 29 | } 30 | if ([item isEqualToString:@"mapType"]) 31 | { 32 | [output setObject:[value mapTypeString] forKey:item]; 33 | } 34 | else if ([item isEqualToString:@"scrollEnabled"]) 35 | { 36 | [output setObject:[value booleanString] forKey:item]; 37 | } 38 | else if ([item isEqualToString:@"zoomEnabled"]) 39 | { 40 | [output setObject:[value booleanString] forKey:item]; 41 | } 42 | else 43 | { 44 | [super processKey:item value:value]; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /NibProcessor/Processors/Processor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Processor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/16/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import 10 | 11 | @interface Processor : NSObject 12 | { 13 | @protected 14 | NSMutableDictionary *output; 15 | @private 16 | NSDictionary *input; 17 | NSSet *ignoredProperties; 18 | } 19 | 20 | @property (nonatomic, readonly) NSDictionary *input; 21 | 22 | + (Processor *)processorForClass:(NSString *)klass; 23 | 24 | - (NSDictionary *)processObject:(NSDictionary *)object; 25 | - (void)processKey:(id)item value:(id)value; 26 | - (NSString *)frameString; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /NibProcessor/Processors/Processor.m: -------------------------------------------------------------------------------- 1 | // 2 | // Processor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/16/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "Processor.h" 10 | 11 | #import "NSString+Nib2ObjcExtensions.h" 12 | #import "NSNumber+Nib2ObjcExtensions.h" 13 | 14 | #import "UIViewProcessor.h" 15 | #import "UITextFieldProcessor.h" 16 | #import "UIProgressViewProcessor.h" 17 | #import "UISwitchProcessor.h" 18 | #import "UISliderProcessor.h" 19 | #import "UILabelProcessor.h" 20 | #import "UIActivityIndicatorViewProcessor.h" 21 | #import "UIPageControlProcessor.h" 22 | #import "UIButtonProcessor.h" 23 | #import "UISegmentedControlProcessor.h" 24 | #import "UIScrollViewProcessor.h" 25 | #import "UITableViewProcessor.h" 26 | #import "UIImageViewProcessor.h" 27 | #import "UITextViewProcessor.h" 28 | #import "UIPickerViewProcessor.h" 29 | #import "UIWebViewProcessor.h" 30 | #import "UITableViewCellProcessor.h" 31 | #import "UIDatePickerProcessor.h" 32 | #import "UINavigationBarProcessor.h" 33 | #import "UINavigationItemProcessor.h" 34 | #import "UIBarButtonItemProcessor.h" 35 | #import "UISearchBarProcessor.h" 36 | #import "UIToolbarProcessor.h" 37 | #import "UITabBarProcessor.h" 38 | #import "UITabBarItemProcessor.h" 39 | #import "MKMapViewProcessor.h" 40 | #import "UIPinchGestureRecognizerProcessor.h" 41 | #import "UIRotationGestureRecognizerProcessor.h" 42 | #import "UISwipeGestureRecognizerProcessor.h" 43 | #import "UIPanGestureRecognizerProcessor.h" 44 | #import "UILongPressGestureRecognizerProcessor.h" 45 | #import "UIViewControllerProcessor.h" 46 | #import "UITableViewControllerProcessor.h" 47 | #import "UIStepperProcessor.h" 48 | #import "GLKViewControllerProcessor.h" 49 | #import "UITapGestureRecognizerProcessor.h" 50 | #import "GLKViewProcessor.h" 51 | #import "ProxyObjectProcessor.h" 52 | 53 | @interface Processor (Protected) 54 | 55 | - (NSString *)getProcessedClassName; 56 | - (NSString *)constructorString; 57 | 58 | @end 59 | 60 | @implementation Processor 61 | 62 | @synthesize input; 63 | 64 | + (Processor *)processorForClass:(NSString *)klass 65 | { 66 | Processor *processor = nil; 67 | 68 | if ([klass isEqualToString:@"IBUIView"]) processor = [[UIViewProcessor alloc] init]; 69 | else if ([klass isEqualToString:@"IBUITextField"]) processor = [[UITextFieldProcessor alloc] init]; 70 | else if ([klass isEqualToString:@"IBUIProgressView"]) processor = [[UIProgressViewProcessor alloc] init]; 71 | else if ([klass isEqualToString:@"IBUISwitch"]) processor = [[UISwitchProcessor alloc] init]; 72 | else if ([klass isEqualToString:@"IBUISlider"]) processor = [[UISliderProcessor alloc] init]; 73 | else if ([klass isEqualToString:@"IBUILabel"]) processor = [[UILabelProcessor alloc] init]; 74 | else if ([klass isEqualToString:@"IBUIActivityIndicatorView"]) processor = [[UIActivityIndicatorViewProcessor alloc] init]; 75 | else if ([klass isEqualToString:@"IBUIPageControl"]) processor = [[UIPageControlProcessor alloc] init]; 76 | else if ([klass isEqualToString:@"IBUIButton"]) processor = [[UIButtonProcessor alloc] init]; 77 | else if ([klass isEqualToString:@"IBUISegmentedControl"]) processor = [[UISegmentedControlProcessor alloc] init]; 78 | else if ([klass isEqualToString:@"IBUIScrollView"]) processor = [[UIScrollViewProcessor alloc] init]; 79 | else if ([klass isEqualToString:@"IBUITableView"]) processor = [[UITableViewProcessor alloc] init]; 80 | else if ([klass isEqualToString:@"IBUIImageView"]) processor = [[UIImageViewProcessor alloc] init]; 81 | else if ([klass isEqualToString:@"IBUITextView"]) processor = [[UITextViewProcessor alloc] init]; 82 | else if ([klass isEqualToString:@"IBUIPickerView"]) processor = [[UIPickerViewProcessor alloc] init]; 83 | else if ([klass isEqualToString:@"IBUIWebView"]) processor = [[UIWebViewProcessor alloc] init]; 84 | else if ([klass isEqualToString:@"IBUITableViewCell"]) processor = [[UITableViewCellProcessor alloc] init]; 85 | else if ([klass isEqualToString:@"IBUIDatePicker"]) processor = [[UIDatePickerProcessor alloc] init]; 86 | else if ([klass isEqualToString:@"IBUINavigationBar"]) processor = [[UINavigationBarProcessor alloc] init]; 87 | else if ([klass isEqualToString:@"IBUINavigationItem"]) processor = [[UINavigationItemProcessor alloc] init]; 88 | else if ([klass isEqualToString:@"IBUIBarButtonItem"]) processor = [[UIBarButtonItemProcessor alloc] init]; 89 | else if ([klass isEqualToString:@"IBUISearchBar"]) processor = [[UISearchBarProcessor alloc] init]; 90 | else if ([klass isEqualToString:@"IBUIToolbar"]) processor = [[UIToolbarProcessor alloc] init]; 91 | else if ([klass isEqualToString:@"IBUITabBar"]) processor = [[UITabBarProcessor alloc] init]; 92 | else if ([klass isEqualToString:@"IBUITabBarItem"]) processor = [[UITabBarItemProcessor alloc] init]; 93 | else if ([klass isEqualToString:@"IBMKMapView"]) processor = [[MKMapViewProcessor alloc] init]; 94 | else if ([klass isEqualToString:@"IBUIPinchGestureRecognizer"]) processor = [[UIPinchGestureRecognizerProcessor alloc] init]; 95 | else if ([klass isEqualToString:@"IBUIRotationGestureRecognizer"]) processor = [[UIRotationGestureRecognizerProcessor alloc] init]; 96 | else if ([klass isEqualToString:@"IBUISwipeGestureRecognizer"]) processor = [[UISwipeGestureRecognizerProcessor alloc] init]; 97 | else if ([klass isEqualToString:@"IBUIPanGestureRecognizer"]) processor = [[UIPanGestureRecognizerProcessor alloc] init]; 98 | else if ([klass isEqualToString:@"IBUILongPressGestureRecognizer"]) processor = [[UILongPressGestureRecognizerProcessor alloc] init]; 99 | else if ([klass isEqualToString:@"IBUIViewController"]) processor = [[UIViewControllerProcessor alloc] init]; 100 | else if ([klass isEqualToString:@"IBUITableViewController"]) processor = [[UITableViewControllerProcessor alloc] init]; 101 | else if ([klass isEqualToString:@"IBUIStepper"]) processor = [[UIStepperProcessor alloc] init]; 102 | else if ([klass isEqualToString:@"IBGLKViewController"]) processor = [[GLKViewControllerProcessor alloc] init]; 103 | else if ([klass isEqualToString:@"IBUITapGestureRecognizer"]) processor = [[UITapGestureRecognizerProcessor alloc] init]; 104 | else if ([klass isEqualToString:@"IBGLKView"]) processor = [[GLKViewProcessor alloc] init]; 105 | else if ([klass isEqualToString:@"IBProxyObject"]) processor = [[ProxyObjectProcessor alloc] init]; 106 | 107 | return [processor autorelease]; 108 | } 109 | 110 | - (id)init 111 | { 112 | self = [super init]; 113 | if (self) 114 | { 115 | ignoredProperties = [[NSSet alloc] initWithObjects:@"ibExternalIdentityShowNotesWithSelection", 116 | @"systemItemIdentifier", 117 | @"autoresizesSubviewsForDevice", 118 | @"backgroundFilters", 119 | @"canDrawConcurrently", 120 | @"clipsSubviews", 121 | @"contentFilters", 122 | @"focusRingType", 123 | @"frameCenterRotation", 124 | @"alphaValue", 125 | @"frameOrigin", 126 | @"frameSize", 127 | @"ibExternalTranslatesAutoresizingMaskIntoConstraints", 128 | @"ibShadowedHorizontalContentCompressionResistancePriority", 129 | @"ibShadowedHorizontalContentHuggingPriority", 130 | @"ibShadowedVerticalContentCompressionResistancePriority", 131 | @"ibShadowedVerticalContentHuggingPriority", 132 | @"opaqueForDevice", 133 | @"simulatedOrientationMetrics", 134 | @"wantsLayer", 135 | @"autoresizesArchivedViewToFullSize", 136 | @"designatedEntryPoint", 137 | @"simulatedStatusBarMetrics", 138 | @"contentInset", 139 | @"dataMode", 140 | @"scrollIndicatorInsets", 141 | @"showsSelectionImmediatelyOnTouchBegin", 142 | @"ibExternalExplicitLabel", 143 | @"fontDescription", 144 | @"edgeInsetsContent", 145 | @"edgeInsetsImage", 146 | @"edgeInsetsTitle", 147 | @"highlightedColor", 148 | @"proxiedObjectIdentifier", 149 | @"ibExternalCustomClassName", nil]; 150 | } 151 | return self; 152 | } 153 | 154 | - (void)dealloc 155 | { 156 | [ignoredProperties release]; 157 | [output release]; 158 | [input release]; 159 | [super dealloc]; 160 | } 161 | 162 | #pragma mark - 163 | #pragma mark Public method 164 | 165 | - (NSDictionary *)processObject:(NSDictionary *)object 166 | { 167 | input = [object retain]; 168 | [output release]; 169 | output = [[NSMutableDictionary alloc] init]; 170 | 171 | for (id item in input) 172 | { 173 | id value = [input objectForKey:item]; 174 | [self processKey:item value:value]; 175 | 176 | #ifdef CONFIGURATION_Debug 177 | // This will show properties not yet known by nib2objc 178 | if ([output objectForKey:item] == nil && 179 | ![ignoredProperties containsObject:item]) 180 | { 181 | id object = [NSString stringWithFormat:@"// unknown property: %@", value]; 182 | [output setObject:object forKey:item]; 183 | } 184 | #endif 185 | } 186 | 187 | // Because of proxy objects, this call should be done at the end 188 | // when all the properties of the object have been parsed 189 | [output setObject:[self constructorString] forKey:@"constructor"]; 190 | 191 | NSString *frameString = [self frameString]; 192 | if (nil != frameString) 193 | { 194 | [output setObject:frameString forKey:@"frame"]; 195 | } 196 | 197 | return output; 198 | } 199 | 200 | - (void)processKey:(id)item value:(id)value 201 | { 202 | // Overridden in subclasses 203 | } 204 | 205 | - (NSString *)frameString 206 | { 207 | return nil; 208 | } 209 | 210 | - (NSString *)constructorString 211 | { 212 | // Some subclasses have different constructors than the classic 213 | // "initWithFrame:", and as such they should override this method. 214 | return [NSString stringWithFormat:@"[[%@ alloc] init]", [self getProcessedClassName]]; 215 | } 216 | 217 | @end 218 | -------------------------------------------------------------------------------- /NibProcessor/Processors/ProxyObjectProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProxyObjectProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "Processor.h" 10 | 11 | @interface ProxyObjectProcessor : Processor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/ProxyObjectProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProxyObjectProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "ProxyObjectProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation ProxyObjectProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | #pragma mark - Private methods 20 | 21 | - (NSString *)getProcessedClassName 22 | { 23 | return @"NSProxy"; 24 | } 25 | 26 | - (void)processKey:(id)item value:(id)value 27 | { 28 | // Subclasses can override this method for their own properties. 29 | // In those cases, call [super processUnknownProperty:item value:value]; 30 | // to be sure that mother classes do their work too. 31 | 32 | id object = nil; 33 | if ([item isEqualToString:@"custom-class"]) 34 | { 35 | [output setObject:value forKey:@"class"]; 36 | } 37 | if (object != nil) 38 | { 39 | [output setObject:object forKey:item]; 40 | } 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIActivityIndicatorViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIActivityIndicatorViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UIActivityIndicatorViewProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIActivityIndicatorViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIActivityIndicatorViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIActivityIndicatorViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIActivityIndicatorViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIActivityIndicatorView"; 22 | } 23 | 24 | - (NSString *)constructorString 25 | { 26 | NSString *style = [[self.input objectForKey:@"style"] activityIndicatorViewStyleString]; 27 | return [NSString stringWithFormat:@"[[%@ alloc] initWithActivityIndicatorStyle:%@]", [self getProcessedClassName], style]; 28 | } 29 | 30 | - (void)processKey:(id)item value:(id)value 31 | { 32 | if ([item isEqualToString:@"hidesWhenStopped"]) 33 | { 34 | [output setObject:[value booleanString] forKey:item]; 35 | } 36 | else if ([item isEqualToString:@"animating"]) 37 | { 38 | BOOL isAnimating = [value boolValue]; 39 | 40 | NSString *stringOutput = (isAnimating) ? @"startAnimating" : @"stopAnimating"; 41 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 42 | } 43 | else 44 | { 45 | [super processKey:item value:value]; 46 | } 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIBarButtonItemProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarButtonItemProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIBarItemProcessor.h" 10 | 11 | @interface UIBarButtonItemProcessor : UIBarItemProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIBarButtonItemProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarButtonItemProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIBarButtonItemProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | #import "NSString+Nib2ObjcExtensions.h" 12 | 13 | @implementation UIBarButtonItemProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UIBarButtonItem"; 23 | } 24 | 25 | - (NSString *)constructorString 26 | { 27 | NSString *constructor = @""; 28 | NSNumber *systemItemIdentifier = [self.input objectForKey:@"systemItemIdentifier"]; 29 | if ([systemItemIdentifier intValue] == -1) 30 | { 31 | NSString *title = [[self.input objectForKey:@"title"] quotedAsCodeString]; 32 | NSString *style = [[self.input objectForKey:@"style"] barButtonItemStyleString]; 33 | constructor = [NSString stringWithFormat:@"[[%@ alloc] initWithTitle:%@ style:%@ target:nil action:nil]", [self getProcessedClassName], title, style]; 34 | } 35 | else 36 | { 37 | NSString *systemItem = [systemItemIdentifier barButtonSystemItemString]; 38 | constructor = [NSString stringWithFormat:@"[[%@ alloc] initWithBarButtonSystemItem:%@ target:nil action:nil]", [self getProcessedClassName], systemItem]; 39 | } 40 | return constructor; 41 | } 42 | 43 | - (void)processKey:(id)item value:(id)value 44 | { 45 | if ([item isEqualToString:@"style"]) 46 | { 47 | [output setObject:[value barButtonItemStyleString] forKey:item]; 48 | } 49 | else if ([item isEqualToString:@"width"]) 50 | { 51 | [output setObject:[value floatString] forKey:item]; 52 | } 53 | else 54 | { 55 | [super processKey:item value:value]; 56 | } 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIBarItemProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarItemProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "Processor.h" 10 | 11 | @interface UIBarItemProcessor : Processor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIBarItemProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarItemProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIBarItemProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | 13 | @implementation UIBarItemProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UIBarItem"; 23 | } 24 | 25 | - (void)processKey:(id)item value:(id)value 26 | { 27 | id object = nil; 28 | if ([item isEqualToString:@"class"]) 29 | { 30 | object = [self getProcessedClassName]; 31 | } 32 | else if ([item isEqualToString:@"title"]) 33 | { 34 | object = [value quotedAsCodeString]; 35 | } 36 | else if ([item isEqualToString:@"tag"]) 37 | { 38 | object = [value intString]; 39 | } 40 | else if ([item isEqualToString:@"enabled"]) 41 | { 42 | object = [value booleanString]; 43 | } 44 | else if ([item isEqualToString:@"image"]) 45 | { 46 | object = @"nil"; 47 | } 48 | else if ([item isEqualToString:@"imageInsets"]) 49 | { 50 | object = @"UIEdgeInsetsZero"; 51 | } 52 | if (object != nil) 53 | { 54 | [output setObject:object forKey:item]; 55 | } 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIButtonProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButtonProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | 11 | @interface UIButtonProcessor : UIControlProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIButtonProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIButtonProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIButtonProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | #import "NSDictionary+Nib2ObjcExtensions.h" 12 | #import "NSString+Nib2ObjcExtensions.h" 13 | 14 | @implementation UIButtonProcessor 15 | 16 | - (void)dealloc 17 | { 18 | [super dealloc]; 19 | } 20 | 21 | - (NSString *)getProcessedClassName 22 | { 23 | return @"UIButton"; 24 | } 25 | 26 | - (NSString *)constructorString 27 | { 28 | NSString *style = [[self.input objectForKey:@"buttonType"] buttonTypeString]; 29 | return [NSString stringWithFormat:@"[%@ buttonWithType:%@]", [self getProcessedClassName], style]; 30 | } 31 | 32 | - (void)processKey:(id)item value:(id)value 33 | { 34 | if ([item isEqualToString:@"adjustsImageWhenDisabled"]) 35 | { 36 | [output setObject:[value booleanString] forKey:item]; 37 | } 38 | else if ([item isEqualToString:@"adjustsImageWhenHighlighted"]) 39 | { 40 | [output setObject:[value booleanString] forKey:item]; 41 | } 42 | else if ([item isEqualToString:@"font"]) 43 | { 44 | [output setObject:[value fontString] forKey:@"titleLabel.font"]; 45 | } 46 | else if ([item isEqualToString:@"lineBreakMode"]) 47 | { 48 | [output setObject:[value lineBreakModeString] forKey:@"titleLabel.lineBreakMode"]; 49 | } 50 | else if ([item isEqualToString:@"reversesTitleShadowWhenHighlighted"]) 51 | { 52 | [output setObject:[value booleanString] forKey:item]; 53 | } 54 | else if ([item isEqualToString:@"showsTouchWhenHighlighted"]) 55 | { 56 | [output setObject:[value booleanString] forKey:item]; 57 | } 58 | else if ([item isEqualToString:@"titleShadowOffset"]) 59 | { 60 | [output setObject:[value sizeString] forKey:@"titleLabel.shadowOffset"]; 61 | } 62 | 63 | // Creation of methods for the titles, instead of properties 64 | else if ([item isEqualToString:@"normalTitle"]) 65 | { 66 | NSString *stringOutput = [NSString stringWithFormat:@"setTitle:%@ forState:UIControlStateNormal", [value quotedAsCodeString]]; 67 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 68 | } 69 | else if ([item isEqualToString:@"selectedTitle"]) 70 | { 71 | NSString *stringOutput = [NSString stringWithFormat:@"setTitle:%@ forState:UIControlStateSelected", [value quotedAsCodeString]]; 72 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 73 | } 74 | else if ([item isEqualToString:@"highlightedTitle"]) 75 | { 76 | NSString *stringOutput = [NSString stringWithFormat:@"setTitle:%@ forState:UIControlStateHighlighted", [value quotedAsCodeString]]; 77 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 78 | } 79 | else if ([item isEqualToString:@"disabledTitle"]) 80 | { 81 | NSString *stringOutput = [NSString stringWithFormat:@"setTitle:%@ forState:UIControlStateDisabled", [value quotedAsCodeString]]; 82 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 83 | } 84 | 85 | // Creation of methods for the title colors, instead of properties 86 | else if ([item isEqualToString:@"normalTitleColor"]) 87 | { 88 | NSString *stringOutput = [NSString stringWithFormat:@"setTitleColor:%@ forState:UIControlStateNormal", [value colorString]]; 89 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 90 | } 91 | else if ([item isEqualToString:@"selectedTitleColor"]) 92 | { 93 | NSString *stringOutput = [NSString stringWithFormat:@"setTitleColor:%@ forState:UIControlStateSelected", [value colorString]]; 94 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 95 | } 96 | else if ([item isEqualToString:@"highlightedTitleColor"]) 97 | { 98 | NSString *stringOutput = [NSString stringWithFormat:@"setTitleColor:%@ forState:UIControlStateHighlighted", [value colorString]]; 99 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 100 | } 101 | else if ([item isEqualToString:@"disabledTitleColor"]) 102 | { 103 | NSString *stringOutput = [NSString stringWithFormat:@"setTitleColor:%@ forState:UIControlStateDisabled", [value colorString]]; 104 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 105 | } 106 | 107 | // Creation of methods for the title shadow colors, instead of properties 108 | else if ([item isEqualToString:@"normalTitleShadowColor"]) 109 | { 110 | NSString *stringOutput = [NSString stringWithFormat:@"setTitleShadowColor:%@ forState:UIControlStateNormal", [value colorString]]; 111 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 112 | } 113 | else if ([item isEqualToString:@"selectedTitleShadowColor"]) 114 | { 115 | NSString *stringOutput = [NSString stringWithFormat:@"setTitleShadowColor:%@ forState:UIControlStateSelected", [value colorString]]; 116 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 117 | } 118 | else if ([item isEqualToString:@"highlightedTitleShadowColor"]) 119 | { 120 | NSString *stringOutput = [NSString stringWithFormat:@"setTitleShadowColor:%@ forState:UIControlStateHighlighted", [value colorString]]; 121 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 122 | } 123 | else if ([item isEqualToString:@"disabledTitleShadowColor"]) 124 | { 125 | NSString *stringOutput = [NSString stringWithFormat:@"setTitleShadowColor:%@ forState:UIControlStateDisabled", [value colorString]]; 126 | [output setObject:stringOutput forKey:[NSString stringWithFormat:@"__method__%@", item]]; 127 | } 128 | 129 | else 130 | { 131 | [super processKey:item value:value]; 132 | } 133 | } 134 | 135 | @end 136 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIControlProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIControlProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UIControlProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIControlProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIControlProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | 13 | @implementation UIControlProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (void)processKey:(id)item value:(id)value 21 | { 22 | if ([item isEqualToString:@"contentHorizontalAlignment"]) 23 | { 24 | [output setObject:[value contentHorizontalAlignmentString] forKey:item]; 25 | } 26 | else if ([item isEqualToString:@"contentVerticalAlignment"]) 27 | { 28 | [output setObject:[value contentVerticalAlignmentString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"enabled"]) 31 | { 32 | [output setObject:[value booleanString] forKey:item]; 33 | } 34 | else if ([item isEqualToString:@"highlighted"]) 35 | { 36 | [output setObject:[value booleanString] forKey:item]; 37 | } 38 | else if ([item isEqualToString:@"selected"]) 39 | { 40 | [output setObject:[value booleanString] forKey:item]; 41 | } 42 | else 43 | { 44 | [super processKey:item value:value]; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIDatePickerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIDatePickerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | 11 | @interface UIDatePickerProcessor : UIControlProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIDatePickerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIDatePickerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIDatePickerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | #import "NSString+Nib2ObjcExtensions.h" 12 | 13 | @implementation UIDatePickerProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UIDatePicker"; 23 | } 24 | 25 | - (void)processKey:(id)item value:(id)value 26 | { 27 | if ([item isEqualToString:@"datePickerMode"]) 28 | { 29 | [output setObject:[value datePickerModeString] forKey:item]; 30 | } 31 | else if ([item isEqualToString:@"timeZone"]) 32 | { 33 | // NSTimeZone instances are not supported by ibtool 34 | [output setObject:@"nil" forKey:item]; 35 | } 36 | else if ([item isEqualToString:@"locale"]) 37 | { 38 | // NSLocale instances are not supported by ibtool 39 | [output setObject:@"nil" forKey:item]; 40 | } 41 | else if ([item isEqualToString:@"minuteInterval"]) 42 | { 43 | // NSLocale instances are not supported by ibtool 44 | [output setObject:[value intString] forKey:item]; 45 | } 46 | else if ([item isEqualToString:@"date"]) 47 | { 48 | NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 49 | [formatter setDateStyle:NSDateFormatterFullStyle]; 50 | [formatter setTimeStyle:NSDateFormatterFullStyle]; 51 | 52 | NSString *stringObject = [NSString stringWithFormat:@"dateFromString(%@)", [[formatter stringFromDate:value] quotedAsCodeString]]; 53 | [output setObject:stringObject forKey:item]; 54 | [output setObject:[NSString dateFromStringFunction] forKey:@"__helper__"]; 55 | } 56 | else if ([item isEqualToString:@"maximumDate"]) 57 | { 58 | NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 59 | [formatter setDateStyle:NSDateFormatterFullStyle]; 60 | [formatter setTimeStyle:NSDateFormatterFullStyle]; 61 | 62 | NSString *stringObject = [NSString stringWithFormat:@"dateFromString(%@)", [[formatter stringFromDate:value] quotedAsCodeString]]; 63 | [output setObject:stringObject forKey:item]; 64 | [output setObject:[NSString dateFromStringFunction] forKey:@"__helper__"]; 65 | } 66 | else if ([item isEqualToString:@"minimumDate"]) 67 | { 68 | NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 69 | [formatter setDateStyle:NSDateFormatterFullStyle]; 70 | [formatter setTimeStyle:NSDateFormatterFullStyle]; 71 | 72 | NSString *stringObject = [NSString stringWithFormat:@"dateFromString(%@)", [[formatter stringFromDate:value] quotedAsCodeString]]; 73 | [output setObject:stringObject forKey:item]; 74 | [output setObject:[NSString dateFromStringFunction] forKey:@"__helper__"]; 75 | } 76 | else if ([item isEqualToString:@"countDownDuration"]) 77 | { 78 | // NSLocale instances are not supported by ibtool 79 | [output setObject:[value intString] forKey:item]; 80 | } 81 | else 82 | { 83 | [super processKey:item value:value]; 84 | } 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIGestureRecognizerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "Processor.h" 10 | 11 | @interface UIGestureRecognizerProcessor : Processor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIGestureRecognizerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIGestureRecognizerProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | 13 | @implementation UIGestureRecognizerProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UIGestureRecognizer"; 23 | } 24 | 25 | - (void)processKey:(id)item value:(id)value 26 | { 27 | id object = nil; 28 | if ([item isEqualToString:@"class"]) 29 | { 30 | object = [self getProcessedClassName]; 31 | } 32 | else if ([item isEqualToString:@"enabled"]) 33 | { 34 | object = [value booleanString]; 35 | } 36 | else if ([item isEqualToString:@"cancelsTouchesInView"]) 37 | { 38 | object = [value booleanString]; 39 | } 40 | else if ([item isEqualToString:@"delaysTouchesBegan"]) 41 | { 42 | object = [value booleanString]; 43 | } 44 | else if ([item isEqualToString:@"delaysTouchesEnded"]) 45 | { 46 | object = [value booleanString]; 47 | } 48 | if (object != nil) 49 | { 50 | [output setObject:object forKey:item]; 51 | } 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIImageViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UIImageViewProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIImageViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIImageViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIImageViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIImageView"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"image"]) 27 | { 28 | // The image property cannot be retrieved by ibtool, 29 | // so here we just add the property with a nil value. 30 | [output setObject:@"nil" forKey:@"image"]; 31 | } 32 | else if ([item isEqualToString:@"highlighted"]) 33 | { 34 | [output setObject:[value booleanString] forKey:item]; 35 | } 36 | else 37 | { 38 | [super processKey:item value:value]; 39 | } 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UILabelProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabelProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UILabelProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UILabelProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabelProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UILabelProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | #import "NSDictionary+Nib2ObjcExtensions.h" 13 | 14 | @implementation UILabelProcessor 15 | 16 | - (void)dealloc 17 | { 18 | [super dealloc]; 19 | } 20 | 21 | - (NSString *)getProcessedClassName 22 | { 23 | return @"UILabel"; 24 | } 25 | 26 | - (void)processKey:(id)item value:(id)value 27 | { 28 | if ([item isEqualToString:@"text"]) 29 | { 30 | [output setObject:[value quotedAsCodeString] forKey:item]; 31 | } 32 | else if ([item isEqualToString:@"textAlignment"]) 33 | { 34 | [output setObject:[value textAlignmentString] forKey:item]; 35 | } 36 | else if ([item isEqualToString:@"textColor"]) 37 | { 38 | [output setObject:[value colorString] forKey:item]; 39 | } 40 | else if ([item isEqualToString:@"font"]) 41 | { 42 | [output setObject:[value fontString] forKey:item]; 43 | } 44 | else if ([item isEqualToString:@"adjustsFontSizeToFitWidth"]) 45 | { 46 | [output setObject:[value booleanString] forKey:item]; 47 | } 48 | else if ([item isEqualToString:@"minimumFontSize"]) 49 | { 50 | [output setObject:[value floatString] forKey:item]; 51 | } 52 | else if ([item isEqualToString:@"enabled"]) 53 | { 54 | [output setObject:[value booleanString] forKey:item]; 55 | } 56 | else if ([item isEqualToString:@"baselineAdjustment"]) 57 | { 58 | [output setObject:[value baselineAdjustmentString] forKey:item]; 59 | } 60 | else if ([item isEqualToString:@"lineBreakMode"]) 61 | { 62 | [output setObject:[value lineBreakModeString] forKey:item]; 63 | } 64 | else if ([item isEqualToString:@"numberOfLines"]) 65 | { 66 | [output setObject:[value intString] forKey:item]; 67 | } 68 | else if ([item isEqualToString:@"shadowOffset"]) 69 | { 70 | [output setObject:[value sizeString] forKey:item]; 71 | } 72 | else if ([item isEqualToString:@"shadowColor"]) 73 | { 74 | [output setObject:[value colorString] forKey:item]; 75 | } 76 | else if ([item isEqualToString:@"highlightedColor"]) 77 | { 78 | [output setObject:[value colorString] forKey:@"highlightedTextColor"]; 79 | } 80 | else 81 | { 82 | [super processKey:item value:value]; 83 | } 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UILongPressGestureRecognizerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILongPressGestureRecognizerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIGestureRecognizerProcessor.h" 10 | 11 | @interface UILongPressGestureRecognizerProcessor : UIGestureRecognizerProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UILongPressGestureRecognizerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILongPressGestureRecognizerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UILongPressGestureRecognizerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UILongPressGestureRecognizerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UILongPressGestureRecognizer"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"minimumPressDuration"]) 27 | { 28 | [output setObject:[value floatString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"allowableMovement"]) 31 | { 32 | [output setObject:[value floatString] forKey:item]; 33 | } 34 | else if ([item isEqualToString:@"numberOfTapsRequired"]) 35 | { 36 | [output setObject:[value intString] forKey:item]; 37 | } 38 | else if ([item isEqualToString:@"numberOfTouchesRequired"]) 39 | { 40 | [output setObject:[value intString] forKey:item]; 41 | } 42 | else 43 | { 44 | [super processKey:item value:value]; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UINavigationBarProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBarProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UINavigationBarProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UINavigationBarProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBarProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UINavigationBarProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | 13 | @implementation UINavigationBarProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UINavigationBar"; 23 | } 24 | 25 | - (void)processKey:(id)item value:(id)value 26 | { 27 | if ([item isEqualToString:@"tintColor"]) 28 | { 29 | [output setObject:[value colorString] forKey:item]; 30 | } 31 | else if ([item isEqualToString:@"barStyle"]) 32 | { 33 | [output setObject:[value barStyleString] forKey:item]; 34 | } 35 | else 36 | { 37 | [super processKey:item value:value]; 38 | } 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UINavigationItemProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationItemProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "Processor.h" 10 | 11 | @interface UINavigationItemProcessor : Processor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UINavigationItemProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationItemProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UINavigationItemProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | 12 | @implementation UINavigationItemProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UINavigationItem"; 22 | } 23 | 24 | - (NSString *)constructorString 25 | { 26 | NSString *title = [[self.input objectForKey:@"title"] quotedAsCodeString]; 27 | return [NSString stringWithFormat:@"[[%@ alloc] initWithTitle:%@]", [self getProcessedClassName], title]; 28 | } 29 | 30 | - (void)processKey:(id)item value:(id)value 31 | { 32 | id object = nil; 33 | if ([item isEqualToString:@"class"]) 34 | { 35 | object = [self getProcessedClassName]; 36 | } 37 | else if ([item isEqualToString:@"title"]) 38 | { 39 | object = [value quotedAsCodeString]; 40 | } 41 | else if ([item isEqualToString:@"prompt"]) 42 | { 43 | object = [value quotedAsCodeString]; 44 | } 45 | if (object != nil) 46 | { 47 | [output setObject:object forKey:item]; 48 | } 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIPageControlProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIPageControlProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | 11 | @interface UIPageControlProcessor : UIControlProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIPageControlProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIPageControlProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIPageControlProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIPageControlProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIPageControl"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"currentPage"]) 27 | { 28 | [output setObject:[value intString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"numberOfPages"]) 31 | { 32 | [output setObject:[value intString] forKey:item]; 33 | } 34 | else if ([item isEqualToString:@"hidesForSinglePage"]) 35 | { 36 | [output setObject:[value booleanString] forKey:item]; 37 | } 38 | else if ([item isEqualToString:@"defersCurrentPageDisplay"]) 39 | { 40 | [output setObject:[value booleanString] forKey:item]; 41 | } 42 | else 43 | { 44 | [super processKey:item value:value]; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIPanGestureRecognizerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIPanGestureRecognizerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIGestureRecognizerProcessor.h" 10 | 11 | @interface UIPanGestureRecognizerProcessor : UIGestureRecognizerProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIPanGestureRecognizerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIPanGestureRecognizerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIPanGestureRecognizerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIPanGestureRecognizerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIPanGestureRecognizer"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"minimumNumberOfTouches"]) 27 | { 28 | [output setObject:[value intString] forKey:item]; 29 | } 30 | else 31 | { 32 | [super processKey:item value:value]; 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIPickerViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIPickerViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UIPickerViewProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIPickerViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIPickerViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIPickerViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIPickerViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIPickerView"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"showsSelectionIndicator"]) 27 | { 28 | [output setObject:[value booleanString] forKey:item]; 29 | } 30 | else 31 | { 32 | [super processKey:item value:value]; 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIPinchGestureRecognizerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIPinchGestureRecognizerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIGestureRecognizerProcessor.h" 10 | 11 | @interface UIPinchGestureRecognizerProcessor : UIGestureRecognizerProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIPinchGestureRecognizerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIPinchGestureRecognizerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIPinchGestureRecognizerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIPinchGestureRecognizerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIPinchGestureRecognizer"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"scale"]) 27 | { 28 | [output setObject:[value floatString] forKey:item]; 29 | } 30 | else 31 | { 32 | [super processKey:item value:value]; 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIProgressViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIProgressViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UIProgressViewProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIProgressViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIProgressViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIProgressViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIProgressViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIProgressView"; 22 | } 23 | 24 | - (NSString *)constructorString 25 | { 26 | NSString *style = [[self.input objectForKey:@"progressViewStyle"] progressViewStyleString]; 27 | return [NSString stringWithFormat:@"[[%@ alloc] initWithProgressViewStyle:%@]", [self getProcessedClassName], style]; 28 | } 29 | 30 | - (void)processKey:(id)item value:(id)value 31 | { 32 | if ([item isEqualToString:@"progress"]) 33 | { 34 | [output setObject:[value floatString] forKey:item]; 35 | } 36 | else if ([item isEqualToString:@"progressViewStyle"]) 37 | { 38 | [output setObject:[value progressViewStyleString] forKey:item]; 39 | } 40 | else 41 | { 42 | [super processKey:item value:value]; 43 | } 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIRotationGestureRecognizerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIRotationGestureRecognizerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIGestureRecognizerProcessor.h" 10 | 11 | @interface UIRotationGestureRecognizerProcessor : UIGestureRecognizerProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIRotationGestureRecognizerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIRotationGestureRecognizerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIRotationGestureRecognizerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIRotationGestureRecognizerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIRotationGestureRecognizer"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"rotation"]) 27 | { 28 | [output setObject:[value floatString] forKey:item]; 29 | } 30 | else 31 | { 32 | [super processKey:item value:value]; 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIScrollViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UIScrollViewProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIScrollViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIScrollViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIScrollViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIScrollView"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"indicatorStyle"]) 27 | { 28 | [output setObject:[value scrollViewIndicatorStyleString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"showsHorizontalScrollIndicator"]) 31 | { 32 | [output setObject:[value booleanString] forKey:item]; 33 | } 34 | else if ([item isEqualToString:@"showsVerticalScrollIndicator"]) 35 | { 36 | [output setObject:[value booleanString] forKey:item]; 37 | } 38 | else if ([item isEqualToString:@"scrollEnabled"]) 39 | { 40 | [output setObject:[value booleanString] forKey:item]; 41 | } 42 | else if ([item isEqualToString:@"pagingEnabled"]) 43 | { 44 | [output setObject:[value booleanString] forKey:item]; 45 | } 46 | else if ([item isEqualToString:@"directionalLockEnabled"]) 47 | { 48 | [output setObject:[value booleanString] forKey:item]; 49 | } 50 | else if ([item isEqualToString:@"bounces"]) 51 | { 52 | [output setObject:[value booleanString] forKey:item]; 53 | } 54 | else if ([item isEqualToString:@"alwaysBounceHorizontal"]) 55 | { 56 | [output setObject:[value booleanString] forKey:item]; 57 | } 58 | else if ([item isEqualToString:@"alwaysBounceVertical"]) 59 | { 60 | [output setObject:[value booleanString] forKey:item]; 61 | } 62 | else if ([item isEqualToString:@"maximumZoomScale"]) 63 | { 64 | [output setObject:[value floatString] forKey:item]; 65 | } 66 | else if ([item isEqualToString:@"minimumZoomScale"]) 67 | { 68 | [output setObject:[value floatString] forKey:item]; 69 | } 70 | else if ([item isEqualToString:@"bouncesZoom"]) 71 | { 72 | [output setObject:[value booleanString] forKey:item]; 73 | } 74 | else if ([item isEqualToString:@"delaysContentTouches"]) 75 | { 76 | [output setObject:[value booleanString] forKey:item]; 77 | } 78 | else if ([item isEqualToString:@"canCancelContentTouches"]) 79 | { 80 | [output setObject:[value booleanString] forKey:item]; 81 | } 82 | else 83 | { 84 | [super processKey:item value:value]; 85 | } 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISearchBarProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISearchBarProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UISearchBarProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISearchBarProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISearchBarProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UISearchBarProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | #import "NSString+Nib2ObjcExtensions.h" 12 | 13 | @implementation UISearchBarProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UISearchBar"; 23 | } 24 | 25 | - (void)processKey:(id)item value:(id)value 26 | { 27 | if ([item isEqualToString:@"tintColor"]) 28 | { 29 | [output setObject:[value colorString] forKey:item]; 30 | } 31 | else if ([item isEqualToString:@"showsBookmarkButton"]) 32 | { 33 | [output setObject:[value booleanString] forKey:item]; 34 | } 35 | else if ([item isEqualToString:@"showsCancelButton"]) 36 | { 37 | [output setObject:[value booleanString] forKey:item]; 38 | } 39 | else if ([item isEqualToString:@"showsScopeBar"]) 40 | { 41 | [output setObject:[value booleanString] forKey:item]; 42 | } 43 | else if ([item isEqualToString:@"showsSearchResultsButton"]) 44 | { 45 | [output setObject:[value booleanString] forKey:item]; 46 | } 47 | else if ([item isEqualToString:@"text"]) 48 | { 49 | [output setObject:[value quotedAsCodeString] forKey:item]; 50 | } 51 | else if ([item isEqualToString:@"scopeButtonTitles"]) 52 | { 53 | NSMutableString *string = [NSMutableString stringWithString:@"[NSArray arrayWithObjects:"]; 54 | for (id element in value) 55 | { 56 | [string appendFormat:@"@\"%@\", ", element]; 57 | } 58 | [string appendString:@"nil]"]; 59 | [output setObject:string forKey:item]; 60 | } 61 | else if ([item isEqualToString:@"placeholder"]) 62 | { 63 | [output setObject:[value quotedAsCodeString] forKey:item]; 64 | } 65 | else if ([item isEqualToString:@"prompt"]) 66 | { 67 | [output setObject:[value quotedAsCodeString] forKey:item]; 68 | } 69 | else if ([item isEqualToString:@"barStyle"]) 70 | { 71 | [output setObject:[value barStyleString] forKey:item]; 72 | } 73 | else 74 | { 75 | [super processKey:item value:value]; 76 | } 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISegmentedControlProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISegmentedControlProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | 11 | @interface UISegmentedControlProcessor : UIControlProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISegmentedControlProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISegmentedControlProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UISegmentedControlProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | 13 | @implementation UISegmentedControlProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UISegmentedControl"; 23 | } 24 | 25 | - (NSString *)constructorString 26 | { 27 | NSString *items = [[self.input objectForKey:@"segmentTitles"] componentsJoinedByString:@"\", @\""]; 28 | return [NSString stringWithFormat:@"[[%@ alloc] initWithItems:[NSArray arrayWithObjects:%@, nil]]", [self getProcessedClassName], [items quotedAsCodeString]]; 29 | } 30 | 31 | - (void)processKey:(id)item value:(id)value 32 | { 33 | if ([item isEqualToString:@"segmentControlStyle"]) 34 | { 35 | [output setObject:[value segmentedControlStyleString] forKey:@"segmentedControlStyle"]; 36 | } 37 | else if ([item isEqualToString:@"selectedSegmentIndex"]) 38 | { 39 | [output setObject:[value intString] forKey:item]; 40 | } 41 | else if ([item isEqualToString:@"momentary"]) 42 | { 43 | [output setObject:[value booleanString] forKey:item]; 44 | } 45 | else 46 | { 47 | [super processKey:item value:value]; 48 | } 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISliderProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISliderProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | 11 | @interface UISliderProcessor : UIControlProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISliderProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISliderProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UISliderProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UISliderProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UISlider"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"continuous"]) 27 | { 28 | [output setObject:[value booleanString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"maxValue"]) 31 | { 32 | [output setObject:[value floatString] forKey:@"maximumValue"]; 33 | } 34 | else if ([item isEqualToString:@"minValue"]) 35 | { 36 | [output setObject:[value floatString] forKey:@"minimumValue"]; 37 | } 38 | else if ([item isEqualToString:@"value"]) 39 | { 40 | [output setObject:[value floatString] forKey:@"value"]; 41 | } 42 | else 43 | { 44 | [super processKey:item value:value]; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIStepperProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIStepperProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | 11 | @interface UIStepperProcessor : UIControlProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIStepperProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIStepperProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIStepperProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIStepperProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIStepper"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"autorepeat"]) 27 | { 28 | [output setObject:[value booleanString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"continuous"]) 31 | { 32 | [output setObject:[value booleanString] forKey:item]; 33 | } 34 | else if ([item isEqualToString:@"maximumValue"]) 35 | { 36 | [output setObject:[value floatString] forKey:item]; 37 | } 38 | else if ([item isEqualToString:@"minimumValue"]) 39 | { 40 | [output setObject:[value floatString] forKey:item]; 41 | } 42 | else if ([item isEqualToString:@"stepValue"]) 43 | { 44 | [output setObject:[value floatString] forKey:item]; 45 | } 46 | else if ([item isEqualToString:@"value"]) 47 | { 48 | [output setObject:[value floatString] forKey:item]; 49 | } 50 | else if ([item isEqualToString:@"wraps"]) 51 | { 52 | [output setObject:[value booleanString] forKey:item]; 53 | } 54 | else 55 | { 56 | [super processKey:item value:value]; 57 | } 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISwipeGestureRecognizerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISwipeGestureRecognizerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIGestureRecognizerProcessor.h" 10 | 11 | @interface UISwipeGestureRecognizerProcessor : UIGestureRecognizerProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISwipeGestureRecognizerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISwipeGestureRecognizerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UISwipeGestureRecognizerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UISwipeGestureRecognizerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UISwipeGestureRecognizer"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"numberOfTouchesRequired"]) 27 | { 28 | [output setObject:[value intString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"direction"]) 31 | { 32 | [output setObject:[value swipeGestureRecognizerDirectionString] forKey:item]; 33 | } 34 | else 35 | { 36 | [super processKey:item value:value]; 37 | } 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISwitchProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISwitchProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | 11 | @interface UISwitchProcessor : UIControlProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UISwitchProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISwitchProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UISwitchProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UISwitchProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UISwitch"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"on"]) 27 | { 28 | [output setObject:[value booleanString] forKey:item]; 29 | } 30 | else 31 | { 32 | [super processKey:item value:value]; 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITabBarItemProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarItemProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIBarItemProcessor.h" 10 | 11 | @interface UITabBarItemProcessor : UIBarItemProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITabBarItemProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarItemProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UITabBarItemProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | 13 | @implementation UITabBarItemProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UITabBarItem"; 23 | } 24 | 25 | - (NSString *)constructorString 26 | { 27 | NSString *constructor = @""; 28 | NSNumber *systemItemIdentifier = [self.input objectForKey:@"systemItemIdentifier"]; 29 | if ([systemItemIdentifier intValue] == -1) 30 | { 31 | NSString *title = [[self.input objectForKey:@"title"] quotedAsCodeString]; 32 | NSString *tag = [[self.input objectForKey:@"tag"] intString]; 33 | constructor = [NSString stringWithFormat:@"[[%@ alloc] initWithTitle:%@ image:nil tag:%@]", [self getProcessedClassName], title, tag]; 34 | } 35 | else 36 | { 37 | NSString *systemItem = [systemItemIdentifier tabBarSystemItemString]; 38 | NSString *tag = [[self.input objectForKey:@"tag"] intString]; 39 | constructor = [NSString stringWithFormat:@"[[%@ alloc] initWithTabBarSystemItem:%@ tag:%@]", [self getProcessedClassName], systemItem, tag]; 40 | } 41 | return constructor; 42 | } 43 | 44 | - (void)processKey:(id)item value:(id)value 45 | { 46 | if ([item isEqualToString:@"badgeValue"]) 47 | { 48 | [output setObject:[value quotedAsCodeString] forKey:item]; 49 | } 50 | else 51 | { 52 | [super processKey:item value:value]; 53 | } 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITabBarProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UITabBarProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITabBarProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UITabBarProcessor.h" 10 | 11 | @implementation UITabBarProcessor 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | - (NSString *)getProcessedClassName 19 | { 20 | return @"UITabBar"; 21 | } 22 | 23 | // This class does not override 24 | // - (void)processKey:(id)item value:(id)value 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITableViewCellProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCellProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/16/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UITableViewCellProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITableViewCellProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCellProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/16/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UITableViewCellProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | #import "NSString+Nib2ObjcExtensions.h" 12 | #import "NSDictionary+Nib2ObjcExtensions.h" 13 | 14 | @implementation UITableViewCellProcessor 15 | 16 | - (void)dealloc 17 | { 18 | [super dealloc]; 19 | } 20 | 21 | - (NSString *)getProcessedClassName 22 | { 23 | return @"UITableViewCell"; 24 | } 25 | 26 | - (NSString *)constructorString 27 | { 28 | NSString *reuseIdentifier = [[self.input objectForKey:@"reuseIdentifier"] quotedAsCodeString]; 29 | if (reuseIdentifier == nil) 30 | { 31 | reuseIdentifier = @"@\"UITableViewCellReuseIdentifier\""; 32 | } 33 | return [NSString stringWithFormat:@"[[%@ alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:%@]", [self getProcessedClassName], reuseIdentifier]; 34 | } 35 | 36 | - (void)processKey:(id)item value:(id)value 37 | { 38 | if ([item isEqualToString:@"textAlignment"]) 39 | { 40 | [output setObject:[value textAlignmentString] forKey:@"textLabel.textAlignment"]; 41 | [output setObject:[value textAlignmentString] forKey:@"detailTextLabel.textAlignment"]; 42 | } 43 | else if ([item isEqualToString:@"lineBreakMode"]) 44 | { 45 | [output setObject:[value lineBreakModeString] forKey:@"textLabel.lineBreakMode"]; 46 | [output setObject:[value lineBreakModeString] forKey:@"detailTextLabel.lineBreakMode"]; 47 | } 48 | else if ([item isEqualToString:@"textColor"]) 49 | { 50 | [output setObject:[value colorString] forKey:@"textLabel.textColor"]; 51 | [output setObject:[value colorString] forKey:@"detailTextLabel.textColor"]; 52 | } 53 | else if ([item isEqualToString:@"selectedTextColor"]) 54 | { 55 | [output setObject:[value colorString] forKey:@"textLabel.highlightedTextColor"]; 56 | [output setObject:[value colorString] forKey:@"detailTextLabel.highlightedTextColor"]; 57 | } 58 | else if ([item isEqualToString:@"font"]) 59 | { 60 | [output setObject:[value fontString] forKey:@"textLabel.font"]; 61 | [output setObject:[value fontString] forKey:@"detailTextLabel.font"]; 62 | } 63 | else if ([item isEqualToString:@"showsReorderControl"]) 64 | { 65 | [output setObject:[value booleanString] forKey:item]; 66 | } 67 | else if ([item isEqualToString:@"shouldIndentWhileEditing"]) 68 | { 69 | [output setObject:[value booleanString] forKey:item]; 70 | } 71 | else if ([item isEqualToString:@"indentationWidth"]) 72 | { 73 | [output setObject:[value floatString] forKey:item]; 74 | } 75 | else if ([item isEqualToString:@"indentationLevel"]) 76 | { 77 | [output setObject:[value intString] forKey:item]; 78 | } 79 | else if ([item isEqualToString:@"accessoryType"]) 80 | { 81 | [output setObject:[value tableViewCellAccessoryString] forKey:item]; 82 | } 83 | else if ([item isEqualToString:@"editingAccessoryType"]) 84 | { 85 | [output setObject:[value tableViewCellAccessoryString] forKey:item]; 86 | } 87 | else if ([item isEqualToString:@"selectionStyle"]) 88 | { 89 | [output setObject:[value tableViewCellSelectionStyleString] forKey:item]; 90 | } 91 | else 92 | { 93 | [super processKey:item value:value]; 94 | } 95 | } 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITableViewControllerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewControllerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIViewControllerProcessor.h" 10 | 11 | @interface UITableViewControllerProcessor : UIViewControllerProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITableViewControllerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewControllerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UITableViewControllerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UITableViewControllerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UITableViewController"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"clearsSelectionOnViewWillAppear"]) 27 | { 28 | [output setObject:[value booleanString] forKey:item]; 29 | } 30 | else 31 | { 32 | [super processKey:item value:value]; 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITableViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIScrollViewProcessor.h" 10 | 11 | @interface UITableViewProcessor : UIScrollViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITableViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UITableViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UITableViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UITableView"; 22 | } 23 | 24 | - (NSString *)constructorString 25 | { 26 | NSString *style = [[self.input objectForKey:@"style"] tableViewStyleString]; 27 | NSString *frame = [self frameString]; 28 | return [NSString stringWithFormat:@"[[%@ alloc] initWithFrame:%@ style:%@]", [self getProcessedClassName], frame, style]; 29 | } 30 | 31 | - (void)processKey:(id)item value:(id)value 32 | { 33 | if ([item isEqualToString:@"rowHeight"]) 34 | { 35 | [output setObject:[value description] forKey:item]; 36 | } 37 | else if ([item isEqualToString:@"sectionFooterHeight"]) 38 | { 39 | [output setObject:[value description] forKey:item]; 40 | } 41 | else if ([item isEqualToString:@"sectionHeaderHeight"]) 42 | { 43 | [output setObject:[value description] forKey:item]; 44 | } 45 | else if ([item isEqualToString:@"separatorStyle"]) 46 | { 47 | [output setObject:[value tableViewCellSeparatorStyleString] forKey:item]; 48 | } 49 | else if ([item isEqualToString:@"sectionIndexMinimumDisplayRowCount"]) 50 | { 51 | [output setObject:[value intString] forKey:item]; 52 | } 53 | else if ([item isEqualToString:@"allowsMultipleSelection"]) 54 | { 55 | [output setObject:[value booleanString] forKey:item]; 56 | } 57 | else if ([item isEqualToString:@"allowsMultipleSelectionDuringEditing"]) 58 | { 59 | [output setObject:[value booleanString] forKey:item]; 60 | } 61 | else if ([item isEqualToString:@"allowsSelection"]) 62 | { 63 | [output setObject:[value booleanString] forKey:item]; 64 | } 65 | else if ([item isEqualToString:@"allowsSelectionDuringEditing"]) 66 | { 67 | [output setObject:[value booleanString] forKey:item]; 68 | } 69 | else 70 | { 71 | [super processKey:item value:value]; 72 | } 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITapGestureRecognizerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITapGestureRecognizerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIGestureRecognizerProcessor.h" 10 | 11 | @interface UITapGestureRecognizerProcessor : UIGestureRecognizerProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITapGestureRecognizerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITapGestureRecognizerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UITapGestureRecognizerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UITapGestureRecognizerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UITapGestureRecognizer"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"numberOfTapsRequired"]) 27 | { 28 | [output setObject:[value intString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"numberOfTouchesRequired"]) 31 | { 32 | [output setObject:[value intString] forKey:item]; 33 | } 34 | else 35 | { 36 | [super processKey:item value:value]; 37 | } 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITextFieldProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextFieldProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIControlProcessor.h" 10 | 11 | @interface UITextFieldProcessor : UIControlProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITextFieldProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITextFieldProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/14/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UITextFieldProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | #import "NSDictionary+Nib2ObjcExtensions.h" 13 | 14 | @implementation UITextFieldProcessor 15 | 16 | - (void)dealloc 17 | { 18 | [super dealloc]; 19 | } 20 | 21 | - (NSString *)getProcessedClassName 22 | { 23 | return @"UITextField"; 24 | } 25 | 26 | - (void)processKey:(id)item value:(id)value 27 | { 28 | if ([item isEqualToString:@"text"]) 29 | { 30 | [output setObject:[value quotedAsCodeString] forKey:item]; 31 | } 32 | else if ([item isEqualToString:@"placeholder"]) 33 | { 34 | [output setObject:[value quotedAsCodeString] forKey:item]; 35 | } 36 | else if ([item isEqualToString:@"textAlignment"]) 37 | { 38 | [output setObject:[value textAlignmentString] forKey:item]; 39 | } 40 | else if ([item isEqualToString:@"textColor"]) 41 | { 42 | [output setObject:[value colorString] forKey:item]; 43 | } 44 | else if ([item isEqualToString:@"font"]) 45 | { 46 | [output setObject:[value fontString] forKey:item]; 47 | } 48 | else if ([item isEqualToString:@"borderStyle"]) 49 | { 50 | [output setObject:[value borderStyleString] forKey:item]; 51 | } 52 | else if ([item isEqualToString:@"clearsOnBeginEditing"]) 53 | { 54 | [output setObject:[value booleanString] forKey:item]; 55 | } 56 | else if ([item isEqualToString:@"adjustsFontSizeToFitWidth"]) 57 | { 58 | [output setObject:[value booleanString] forKey:item]; 59 | } 60 | else if ([item isEqualToString:@"minimumFontSize"]) 61 | { 62 | [output setObject:[value floatString] forKey:item]; 63 | } 64 | else if ([item isEqualToString:@"textInputTraits.enablesReturnKeyAutomatically"]) 65 | { 66 | [output setObject:[value booleanString] forKey:@"enablesReturnKeyAutomatically"]; 67 | } 68 | else if ([item isEqualToString:@"textInputTraits.secureTextEntry"]) 69 | { 70 | [output setObject:[value booleanString] forKey:@"secureTextEntry"]; 71 | } 72 | else if ([item isEqualToString:@"textInputTraits.keyboardAppearance"]) 73 | { 74 | [output setObject:[value keyboardAppearanceString] forKey:@"keyboardAppearance"]; 75 | } 76 | else if ([item isEqualToString:@"textInputTraits.returnKeyType"]) 77 | { 78 | [output setObject:[value returnKeyTypeString] forKey:@"returnKeyType"]; 79 | } 80 | else if ([item isEqualToString:@"textInputTraits.autocapitalizationType"]) 81 | { 82 | [output setObject:[value autocapitalizationTypeString] forKey:@"autocapitalizationType"]; 83 | } 84 | else if ([item isEqualToString:@"textInputTraits.autocorrectionType"]) 85 | { 86 | [output setObject:[value autocorrectionTypeString] forKey:@"autocorrectionType"]; 87 | } 88 | else if ([item isEqualToString:@"textInputTraits.keyboardType"]) 89 | { 90 | [output setObject:[value keyboardTypeString] forKey:@"keyboardType"]; 91 | } 92 | else if ([item isEqualToString:@"clearButtonMode"]) 93 | { 94 | [output setObject:[value clearButtonModeString] forKey:item]; 95 | } 96 | else 97 | { 98 | [super processKey:item value:value]; 99 | } 100 | } 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITextViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIScrollViewProcessor.h" 10 | 11 | @interface UITextViewProcessor : UIScrollViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UITextViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITextViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UITextViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | #import "NSString+Nib2ObjcExtensions.h" 12 | #import "NSDictionary+Nib2ObjcExtensions.h" 13 | 14 | @implementation UITextViewProcessor 15 | 16 | - (void)dealloc 17 | { 18 | [super dealloc]; 19 | } 20 | 21 | - (NSString *)getProcessedClassName 22 | { 23 | return @"UITextView"; 24 | } 25 | 26 | - (void)processKey:(id)item value:(id)value 27 | { 28 | if ([item isEqualToString:@"text"]) 29 | { 30 | [output setObject:[value quotedAsCodeString] forKey:item]; 31 | } 32 | else if ([item isEqualToString:@"textAlignment"]) 33 | { 34 | [output setObject:[value textAlignmentString] forKey:item]; 35 | } 36 | else if ([item isEqualToString:@"font"]) 37 | { 38 | [output setObject:[value fontString] forKey:item]; 39 | } 40 | else if ([item isEqualToString:@"textColor"]) 41 | { 42 | [output setObject:[value colorString] forKey:item]; 43 | } 44 | else if ([item isEqualToString:@"editable"]) 45 | { 46 | [output setObject:[value booleanString] forKey:item]; 47 | } 48 | else 49 | { 50 | [super processKey:item value:value]; 51 | } 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIToolbarProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIToolbarProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UIToolbarProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIToolbarProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIToolbarProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/17/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIToolbarProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | 13 | @implementation UIToolbarProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (NSString *)getProcessedClassName 21 | { 22 | return @"UIToolbar"; 23 | } 24 | 25 | - (void)processKey:(id)item value:(id)value 26 | { 27 | if ([item isEqualToString:@"tintColor"]) 28 | { 29 | // As of the iPhone SDK 2.2.1, this property does not seem 30 | // to be exported at all by Interface Builder. 31 | [output setObject:[value colorString] forKey:item]; 32 | } 33 | else if ([item isEqualToString:@"barStyle"]) 34 | { 35 | [output setObject:[value barStyleString] forKey:item]; 36 | } 37 | else 38 | { 39 | [super processKey:item value:value]; 40 | } 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIViewControllerProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewControllerProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "Processor.h" 10 | 11 | @interface UIViewControllerProcessor : Processor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIViewControllerProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewControllerProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian Kosmaczewski on 11/7/11. 6 | // Copyright (c) 2011 akosma software. All rights reserved. 7 | // 8 | 9 | #import "UIViewControllerProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIViewControllerProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIViewController"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | id object = nil; 27 | if ([item isEqualToString:@"class"]) 28 | { 29 | object = [self getProcessedClassName]; 30 | } 31 | else if ([item isEqualToString:@"definesPresentationContext"]) 32 | { 33 | object = [value booleanString]; 34 | } 35 | else if ([item isEqualToString:@"hidesBottomBarWhenPushed"]) 36 | { 37 | object = [value booleanString]; 38 | } 39 | else if ([item isEqualToString:@"wantsFullScreenLayout"]) 40 | { 41 | object = [value booleanString]; 42 | } 43 | else if ([item isEqualToString:@"providesPresentationContextTransitionStyle"]) 44 | { 45 | object = [value booleanString]; 46 | } 47 | else if ([item isEqualToString:@"modalPresentationStyle"]) 48 | { 49 | object = [value modalPresentationStyleString]; 50 | } 51 | else if ([item isEqualToString:@"modalTransitionStyle"]) 52 | { 53 | object = [value modalTransitionStyleString]; 54 | } 55 | if (object != nil) 56 | { 57 | [output setObject:object forKey:item]; 58 | } 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/13/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "Processor.h" 10 | 11 | @interface UIViewProcessor : Processor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/13/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | #import "NSString+Nib2ObjcExtensions.h" 11 | #import "NSNumber+Nib2ObjcExtensions.h" 12 | 13 | @implementation UIViewProcessor 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | #pragma mark - 21 | #pragma mark Private methods 22 | 23 | - (NSString *)getProcessedClassName 24 | { 25 | return @"UIView"; 26 | } 27 | 28 | - (NSString *)frameString 29 | { 30 | NSString *rect = [NSString rectStringFromPoint:[self.input objectForKey:@"frameOrigin"] size:[self.input objectForKey:@"frameSize"]]; 31 | return rect; 32 | } 33 | 34 | - (NSString *)constructorString 35 | { 36 | return [NSString stringWithFormat:@"[[%@ alloc] initWithFrame:%@]", [self getProcessedClassName], [self frameString]]; 37 | } 38 | 39 | - (void)processKey:(id)item value:(id)value 40 | { 41 | // Subclasses can override this method for their own properties. 42 | // In those cases, call [super processUnknownProperty:item value:value]; 43 | // to be sure that mother classes do their work too. 44 | 45 | id object = nil; 46 | if ([item isEqualToString:@"class"]) 47 | { 48 | object = [self getProcessedClassName]; 49 | } 50 | else if ([item isEqualToString:@"autoresizesSubviews"]) 51 | { 52 | object = [value booleanString]; 53 | } 54 | else if ([item isEqualToString:@"contentStretch"]) 55 | { 56 | object = [NSString stringWithFormat:@"CGRectFromString(@\"%@\")", value]; 57 | } 58 | else if ([item isEqualToString:@"alpha"]) 59 | { 60 | object = [value floatString]; 61 | } 62 | else if ([item isEqualToString:@"hidden"]) 63 | { 64 | object = [value booleanString]; 65 | } 66 | else if ([item isEqualToString:@"opaqueForDevice"]) 67 | { 68 | object = [value booleanString]; 69 | item = @"opaque"; 70 | } 71 | else if ([item isEqualToString:@"clipsSubviews"]) 72 | { 73 | object = [value booleanString]; 74 | item = @"clipsToBounds"; 75 | } 76 | else if ([item isEqualToString:@"clearsContextBeforeDrawing"]) 77 | { 78 | object = [value booleanString]; 79 | } 80 | else if ([item isEqualToString:@"userInteractionEnabled"]) 81 | { 82 | object = [value booleanString]; 83 | } 84 | else if ([item isEqualToString:@"multipleTouchEnabled"]) 85 | { 86 | object = [value booleanString]; 87 | } 88 | else if ([item isEqualToString:@"tag"]) 89 | { 90 | object = [value intString]; 91 | } 92 | else if ([item isEqualToString:@"backgroundColor"]) 93 | { 94 | object = [value colorString]; 95 | } 96 | else if ([item isEqualToString:@"contentMode"]) 97 | { 98 | object = [value contentModeString]; 99 | } 100 | else if ([item isEqualToString:@"autoresizingMask"]) 101 | { 102 | object = [value autoresizingMaskString]; 103 | } 104 | if (object != nil) 105 | { 106 | [output setObject:object forKey:item]; 107 | } 108 | } 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIWebViewProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIWebViewProcessor.h 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIViewProcessor.h" 10 | 11 | @interface UIWebViewProcessor : UIViewProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NibProcessor/Processors/UIWebViewProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIWebViewProcessor.m 3 | // nib2objc 4 | // 5 | // Created by Adrian on 3/15/09. 6 | // Adrian Kosmaczewski 2009 7 | // 8 | 9 | #import "UIWebViewProcessor.h" 10 | #import "NSNumber+Nib2ObjcExtensions.h" 11 | 12 | @implementation UIWebViewProcessor 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (NSString *)getProcessedClassName 20 | { 21 | return @"UIWebView"; 22 | } 23 | 24 | - (void)processKey:(id)item value:(id)value 25 | { 26 | if ([item isEqualToString:@"scalesPageToFit"]) 27 | { 28 | [output setObject:[value booleanString] forKey:item]; 29 | } 30 | else if ([item isEqualToString:@"detectsPhoneNumbers"]) 31 | { 32 | [output setObject:[value booleanString] forKey:item]; 33 | } 34 | else 35 | { 36 | [super processKey:item value:value]; 37 | } 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. nib2objc - NIB to Objective-C converter 2 | 3 | This utility converts NIB files (or XIB ones) into Objective-C code, including all the properties of each instance, the documented constructor calls, and also the view hierarchy. It uses the output of the ibtool utility bundled with the Xcode tools. For more information about ibtool, please check "the ibtool man page":http://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/man1/ibtool.1.html. 4 | 5 | h2. Usage 6 | 7 | Compile and put the utility in your path, and then call 8 | 9 |
10 | nib2objc yourfile.xib > code.m
11 | 
12 | 13 | This will generate a file with the output of the conversion, similar to this (check out the included sample.m file for the full version): 14 | 15 |
16 |     // ...
17 |     UIView *view6 = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 460.0)];
18 |     view6.frame = CGRectMake(0.0, 0.0, 320.0, 460.0);
19 |     view6.alpha = 1.000;
20 |     view6.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
21 |     view6.backgroundColor = [UIColor colorWithWhite:0.750 alpha:1.000];
22 |     view6.clearsContextBeforeDrawing = NO;
23 |     // ...
24 | 
25 |     UIButton *button9 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
26 |     button9.frame = CGRectMake(167.0, 65.0, 72.0, 37.0);
27 |     button9.adjustsImageWhenDisabled = YES;
28 |     button9.adjustsImageWhenHighlighted = YES;
29 |     button9.alpha = 1.000;
30 |     button9.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
31 |     button9.clearsContextBeforeDrawing = NO;
32 |     button9.clipsToBounds = NO;
33 |     button9.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
34 |     // ...
35 |     [button9 setTitleShadowColor:[UIColor colorWithWhite:0.000 alpha:1.000] forState:UIControlStateSelected];
36 | 
37 |     // ...
38 |     [view6 addSubview:button9];
39 |     // ...
40 | 
41 | 42 | The generated code takes into account the real class hierarchies in the UIKit, and it outputs the correct constructors and/or method calls for each object, depending on its class, including the enum values corresponding to the properties using them. 43 | 44 | h2. Mac OS X GUI Application 45 | 46 | The "GUI" folder contains a Mac OS X application that can be used to open several nib files and to see their contents as Objective-C code. 47 | 48 | The GUI application uses the "Fragaria":http://github.com/mugginsoft/Fragaria library as a submodule, to provide syntax highlighting of the generated Objective-C code. Prior to compilation, please do the following: 49 | 50 |
51 | $ git submodule init
52 | $ git submodule update
53 | 
54 | 55 | h2. Mac OS X Service 56 | 57 | A secondary project in the "Convert with nib2objc" folder creates an Automator action, that can be used to create Mac OS X services with Automator. The "Convert with nib2objc.zip" file contains an example of such a service, ready to be installed in ~/Library/Services, and which can be called from the Finder after selecting a nib file. The result of the conversion will be placed in the clipboard for pasting into any application. 58 | 59 | h2. Limitations 60 | 61 | * For the moment this utility only works for UIKit views (iPhone), but it should be easy to extend to those of the AppKit too. 62 | * It cannot output the values of UIImage, NSLocale or NSTimeZone properties, because ibtool does not support them. 63 | * It does not distinguishes default values for properties, and as such, it outputs all the information it can find about a particular instance. 64 | 65 | h3. Contributions 66 | 67 | This project includes the *nibs2objc.pl* Perl script by Rudi Farkas, which allows users to perform batch transformations of nib files in a folder. Thanks Rudi for the contribution! 68 | -------------------------------------------------------------------------------- /Sample/sample.m: -------------------------------------------------------------------------------- 1 | UISlider *slider12 = [[UISlider alloc] initWithFrame:CGRectMake(8.0, 101.0, 118.0, 23.0)]; 2 | slider12.frame = CGRectMake(8.0, 101.0, 118.0, 23.0); 3 | slider12.alpha = 1.000; 4 | slider12.autoresizesSubviews = YES; 5 | slider12.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 6 | slider12.clearsContextBeforeDrawing = YES; 7 | slider12.clipsToBounds = YES; 8 | slider12.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 9 | slider12.contentMode = UIViewContentModeScaleToFill; 10 | slider12.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 11 | slider12.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 12 | slider12.continuous = YES; 13 | slider12.enabled = YES; 14 | slider12.hidden = NO; 15 | slider12.highlighted = NO; 16 | slider12.maximumValue = 1.000; 17 | slider12.minimumValue = 0.000; 18 | slider12.multipleTouchEnabled = YES; 19 | slider12.opaque = NO; 20 | slider12.selected = NO; 21 | slider12.tag = 0; 22 | slider12.userInteractionEnabled = YES; 23 | slider12.value = 0.500; 24 | 25 | UISwitch *switch13 = [[UISwitch alloc] initWithFrame:CGRectMake(30.0, 165.0, 94.0, 27.0)]; 26 | switch13.frame = CGRectMake(30.0, 165.0, 94.0, 27.0); 27 | switch13.alpha = 1.000; 28 | switch13.autoresizesSubviews = YES; 29 | switch13.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 30 | switch13.clearsContextBeforeDrawing = YES; 31 | switch13.clipsToBounds = YES; 32 | switch13.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 33 | switch13.contentMode = UIViewContentModeScaleToFill; 34 | switch13.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 35 | switch13.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 36 | switch13.enabled = YES; 37 | switch13.hidden = NO; 38 | switch13.highlighted = NO; 39 | switch13.multipleTouchEnabled = YES; 40 | switch13.on = YES; 41 | switch13.opaque = NO; 42 | switch13.selected = NO; 43 | switch13.tag = 0; 44 | switch13.userInteractionEnabled = YES; 45 | 46 | UIView *view6 = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 460.0)]; 47 | view6.frame = CGRectMake(0.0, 0.0, 320.0, 460.0); 48 | view6.alpha = 1.000; 49 | view6.autoresizesSubviews = YES; 50 | view6.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 51 | view6.backgroundColor = [UIColor colorWithWhite:0.750 alpha:1.000]; 52 | view6.clearsContextBeforeDrawing = NO; 53 | view6.clipsToBounds = NO; 54 | view6.contentMode = UIViewContentModeScaleToFill; 55 | view6.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 56 | view6.hidden = NO; 57 | view6.multipleTouchEnabled = NO; 58 | view6.opaque = YES; 59 | view6.tag = 0; 60 | view6.userInteractionEnabled = YES; 61 | 62 | UIView *view14 = [[UIView alloc] initWithFrame:CGRectMake(146.0, 210.0, 160.0, 230.0)]; 63 | view14.frame = CGRectMake(146.0, 210.0, 160.0, 230.0); 64 | view14.alpha = 0.641; 65 | view14.autoresizesSubviews = YES; 66 | view14.autoresizingMask = UIViewAutoresizingFlexibleHeight; 67 | view14.backgroundColor = [UIColor colorWithRed:0.772 green:0.027 blue:0.000 alpha:1.000]; 68 | view14.clearsContextBeforeDrawing = NO; 69 | view14.clipsToBounds = YES; 70 | view14.contentMode = UIViewContentModeScaleToFill; 71 | view14.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 72 | view14.hidden = NO; 73 | view14.multipleTouchEnabled = YES; 74 | view14.opaque = YES; 75 | view14.tag = 12; 76 | view14.userInteractionEnabled = YES; 77 | 78 | UIView *view40 = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 460.0)]; 79 | view40.frame = CGRectMake(0.0, 0.0, 320.0, 460.0); 80 | view40.alpha = 1.000; 81 | view40.autoresizesSubviews = YES; 82 | view40.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 83 | view40.backgroundColor = [UIColor colorWithWhite:1.000 alpha:1.000]; 84 | view40.clearsContextBeforeDrawing = NO; 85 | view40.clipsToBounds = NO; 86 | view40.contentMode = UIViewContentModeScaleToFill; 87 | view40.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 88 | view40.hidden = NO; 89 | view40.multipleTouchEnabled = NO; 90 | view40.opaque = YES; 91 | view40.tag = 0; 92 | view40.userInteractionEnabled = YES; 93 | 94 | UIView *view23 = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 460.0)]; 95 | view23.frame = CGRectMake(0.0, 0.0, 320.0, 460.0); 96 | view23.alpha = 1.000; 97 | view23.autoresizesSubviews = YES; 98 | view23.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 99 | view23.backgroundColor = [UIColor colorWithWhite:1.000 alpha:1.000]; 100 | view23.clearsContextBeforeDrawing = NO; 101 | view23.clipsToBounds = NO; 102 | view23.contentMode = UIViewContentModeScaleToFill; 103 | view23.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 104 | view23.hidden = NO; 105 | view23.multipleTouchEnabled = NO; 106 | view23.opaque = YES; 107 | view23.tag = 0; 108 | view23.userInteractionEnabled = YES; 109 | 110 | UIView *view32 = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 460.0)]; 111 | view32.frame = CGRectMake(0.0, 0.0, 320.0, 460.0); 112 | view32.alpha = 1.000; 113 | view32.autoresizesSubviews = YES; 114 | view32.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 115 | view32.backgroundColor = [UIColor colorWithWhite:1.000 alpha:1.000]; 116 | view32.clearsContextBeforeDrawing = NO; 117 | view32.clipsToBounds = NO; 118 | view32.contentMode = UIViewContentModeScaleToFill; 119 | view32.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 120 | view32.hidden = NO; 121 | view32.multipleTouchEnabled = NO; 122 | view32.opaque = YES; 123 | view32.tag = 0; 124 | view32.userInteractionEnabled = YES; 125 | 126 | UITextField *textfield8 = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 20.0, 97.0, 31.0)]; 127 | textfield8.frame = CGRectMake(20.0, 20.0, 97.0, 31.0); 128 | textfield8.adjustsFontSizeToFitWidth = YES; 129 | textfield8.alpha = 1.000; 130 | textfield8.autocapitalizationType = UITextAutocapitalizationTypeNone; 131 | textfield8.autocorrectionType = UITextAutocorrectionTypeDefault; 132 | textfield8.autoresizesSubviews = YES; 133 | textfield8.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 134 | textfield8.borderStyle = UITextBorderStyleRoundedRect; 135 | textfield8.clearButtonMode = UITextFieldViewModeNever; 136 | textfield8.clearsContextBeforeDrawing = NO; 137 | textfield8.clearsOnBeginEditing = YES; 138 | textfield8.clipsToBounds = NO; 139 | textfield8.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; 140 | textfield8.contentMode = UIViewContentModeScaleToFill; 141 | textfield8.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 142 | textfield8.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 143 | textfield8.enabled = YES; 144 | textfield8.enablesReturnKeyAutomatically = NO; 145 | textfield8.font = [UIFont fontWithName:@"Helvetica" size:12.000]; 146 | textfield8.hidden = NO; 147 | textfield8.highlighted = NO; 148 | textfield8.keyboardAppearance = UIKeyboardAppearanceDefault; 149 | textfield8.keyboardType = UIKeyboardTypeDefault; 150 | textfield8.minimumFontSize = 17.000; 151 | textfield8.multipleTouchEnabled = NO; 152 | textfield8.opaque = NO; 153 | textfield8.placeholder = @"zapato"; 154 | textfield8.returnKeyType = UIReturnKeyDefault; 155 | textfield8.secureTextEntry = NO; 156 | textfield8.selected = NO; 157 | textfield8.tag = 0; 158 | textfield8.text = @""; 159 | textfield8.textAlignment = UITextAlignmentLeft; 160 | textfield8.textColor = [UIColor colorWithWhite:0.000 alpha:1.000]; 161 | textfield8.userInteractionEnabled = YES; 162 | 163 | UINavigationBar *navigationbar41 = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 74.0)]; 164 | navigationbar41.frame = CGRectMake(0.0, 0.0, 320.0, 74.0); 165 | navigationbar41.alpha = 1.000; 166 | navigationbar41.autoresizesSubviews = YES; 167 | navigationbar41.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; 168 | navigationbar41.barStyle = UIBarStyleDefault; 169 | navigationbar41.clearsContextBeforeDrawing = NO; 170 | navigationbar41.clipsToBounds = NO; 171 | navigationbar41.contentMode = UIViewContentModeScaleToFill; 172 | navigationbar41.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 173 | navigationbar41.hidden = NO; 174 | navigationbar41.multipleTouchEnabled = NO; 175 | navigationbar41.opaque = NO; 176 | navigationbar41.tag = 0; 177 | navigationbar41.tintColor = [UIColor colorWithRed:0.000 green:0.000 blue:1.000 alpha:1.000]; 178 | navigationbar41.userInteractionEnabled = YES; 179 | 180 | UIButton *button9 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 181 | button9.frame = CGRectMake(167.0, 65.0, 72.0, 37.0); 182 | button9.adjustsImageWhenDisabled = YES; 183 | button9.adjustsImageWhenHighlighted = YES; 184 | button9.alpha = 1.000; 185 | button9.autoresizesSubviews = YES; 186 | button9.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 187 | button9.clearsContextBeforeDrawing = NO; 188 | button9.clipsToBounds = NO; 189 | button9.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 190 | button9.contentMode = UIViewContentModeScaleToFill; 191 | button9.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 192 | button9.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 193 | button9.enabled = YES; 194 | button9.hidden = NO; 195 | button9.highlighted = NO; 196 | button9.multipleTouchEnabled = NO; 197 | button9.opaque = NO; 198 | button9.reversesTitleShadowWhenHighlighted = NO; 199 | button9.selected = NO; 200 | button9.showsTouchWhenHighlighted = NO; 201 | button9.tag = 0; 202 | button9.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:15.000]; 203 | button9.titleLabel.lineBreakMode = UILineBreakModeMiddleTruncation; 204 | button9.titleLabel.shadowOffset = CGSizeMake(0.0, 0.0); 205 | button9.userInteractionEnabled = YES; 206 | [button9 setTitle:@"Test" forState:UIControlStateDisabled]; 207 | [button9 setTitle:@"Test" forState:UIControlStateHighlighted]; 208 | [button9 setTitle:@"Test" forState:UIControlStateNormal]; 209 | [button9 setTitle:@"Test" forState:UIControlStateSelected]; 210 | [button9 setTitleColor:[UIColor colorWithRed:0.196 green:0.310 blue:0.522 alpha:1.000] forState:UIControlStateNormal]; 211 | [button9 setTitleColor:[UIColor colorWithRed:1.000 green:1.000 blue:1.000 alpha:1.000] forState:UIControlStateHighlighted]; 212 | [button9 setTitleShadowColor:[UIColor colorWithWhite:0.000 alpha:1.000] forState:UIControlStateNormal]; 213 | 214 | UITabBar *tabbar50 = [[UITabBar alloc] initWithFrame:CGRectMake(0.0, 411.0, 320.0, 49.0)]; 215 | tabbar50.frame = CGRectMake(0.0, 411.0, 320.0, 49.0); 216 | tabbar50.alpha = 1.000; 217 | tabbar50.autoresizesSubviews = YES; 218 | tabbar50.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; 219 | tabbar50.backgroundColor = [UIColor colorWithRed:0.600 green:0.400 blue:0.200 alpha:1.000]; 220 | tabbar50.clearsContextBeforeDrawing = NO; 221 | tabbar50.clipsToBounds = NO; 222 | tabbar50.contentMode = UIViewContentModeScaleToFill; 223 | tabbar50.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 224 | tabbar50.hidden = NO; 225 | tabbar50.multipleTouchEnabled = NO; 226 | tabbar50.opaque = YES; 227 | tabbar50.tag = 0; 228 | tabbar50.userInteractionEnabled = YES; 229 | 230 | UITextView *textview33 = [[UITextView alloc] initWithFrame:CGRectMake(20.0, 20.0, 231.0, 209.0)]; 231 | textview33.frame = CGRectMake(20.0, 20.0, 231.0, 209.0); 232 | textview33.alpha = 1.000; 233 | textview33.alwaysBounceHorizontal = NO; 234 | textview33.alwaysBounceVertical = NO; 235 | textview33.autoresizesSubviews = YES; 236 | textview33.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 237 | textview33.bounces = YES; 238 | textview33.bouncesZoom = NO; 239 | textview33.canCancelContentTouches = NO; 240 | textview33.clearsContextBeforeDrawing = YES; 241 | textview33.clipsToBounds = YES; 242 | textview33.contentMode = UIViewContentModeScaleToFill; 243 | textview33.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 244 | textview33.delaysContentTouches = NO; 245 | textview33.directionalLockEnabled = NO; 246 | textview33.editable = YES; 247 | textview33.font = [UIFont fontWithName:@"Helvetica" size:17.000]; 248 | textview33.hidden = NO; 249 | textview33.indicatorStyle = UIScrollViewIndicatorStyleDefault; 250 | textview33.maximumZoomScale = 1.000; 251 | textview33.minimumZoomScale = 1.000; 252 | textview33.multipleTouchEnabled = YES; 253 | textview33.opaque = NO; 254 | textview33.pagingEnabled = NO; 255 | textview33.scrollEnabled = YES; 256 | textview33.showsHorizontalScrollIndicator = NO; 257 | textview33.showsVerticalScrollIndicator = YES; 258 | textview33.tag = 0; 259 | textview33.text = @"Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda."; 260 | textview33.textAlignment = UITextAlignmentLeft; 261 | textview33.textColor = [UIColor colorWithRed:0.000 green:0.000 blue:1.000 alpha:1.000]; 262 | textview33.userInteractionEnabled = YES; 263 | 264 | UITableView *tableview25 = [[UITableView alloc] initWithFrame:CGRectMake(559.0, 25.0, 215.0, 288.0) style:UITableViewStylePlain]; 265 | tableview25.frame = CGRectMake(559.0, 25.0, 215.0, 288.0); 266 | tableview25.allowsSelectionDuringEditing = NO; 267 | tableview25.alpha = 1.000; 268 | tableview25.alwaysBounceHorizontal = NO; 269 | tableview25.alwaysBounceVertical = NO; 270 | tableview25.autoresizesSubviews = YES; 271 | tableview25.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 272 | tableview25.backgroundColor = [UIColor colorWithWhite:1.000 alpha:1.000]; 273 | tableview25.bounces = YES; 274 | tableview25.bouncesZoom = NO; 275 | tableview25.canCancelContentTouches = YES; 276 | tableview25.clearsContextBeforeDrawing = NO; 277 | tableview25.clipsToBounds = YES; 278 | tableview25.contentMode = UIViewContentModeScaleToFill; 279 | tableview25.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 280 | tableview25.delaysContentTouches = YES; 281 | tableview25.directionalLockEnabled = NO; 282 | tableview25.hidden = NO; 283 | tableview25.indicatorStyle = UIScrollViewIndicatorStyleDefault; 284 | tableview25.maximumZoomScale = 1.000; 285 | tableview25.minimumZoomScale = 1.000; 286 | tableview25.multipleTouchEnabled = NO; 287 | tableview25.opaque = NO; 288 | tableview25.pagingEnabled = NO; 289 | tableview25.rowHeight = 44; 290 | tableview25.scrollEnabled = YES; 291 | tableview25.sectionFooterHeight = 22; 292 | tableview25.sectionHeaderHeight = 22; 293 | tableview25.sectionIndexMinimumDisplayRowCount = 0; 294 | tableview25.separatorStyle = UITableViewCellSeparatorStyleSingleLine; 295 | tableview25.showsHorizontalScrollIndicator = YES; 296 | tableview25.showsVerticalScrollIndicator = YES; 297 | tableview25.tag = 0; 298 | tableview25.userInteractionEnabled = YES; 299 | 300 | UITabBarItem *tabbaritem51 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:0]; 301 | tabbaritem51.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 302 | tabbaritem51.enabled = YES; 303 | tabbaritem51.tag = 0; 304 | 305 | UIPickerView *pickerview34 = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 244.0, 320.0, 216.0)]; 306 | pickerview34.frame = CGRectMake(0.0, 244.0, 320.0, 216.0); 307 | pickerview34.alpha = 1.000; 308 | pickerview34.autoresizesSubviews = YES; 309 | pickerview34.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 310 | pickerview34.clearsContextBeforeDrawing = YES; 311 | pickerview34.clipsToBounds = YES; 312 | pickerview34.contentMode = UIViewContentModeScaleToFill; 313 | pickerview34.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 314 | pickerview34.hidden = NO; 315 | pickerview34.multipleTouchEnabled = YES; 316 | pickerview34.opaque = NO; 317 | pickerview34.showsSelectionIndicator = YES; 318 | pickerview34.tag = 0; 319 | pickerview34.userInteractionEnabled = YES; 320 | 321 | UISearchBar *searchbar43 = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0, 74.0, 320.0, 75.0)]; 322 | searchbar43.frame = CGRectMake(0.0, 74.0, 320.0, 75.0); 323 | searchbar43.alpha = 1.000; 324 | searchbar43.autoresizesSubviews = YES; 325 | searchbar43.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; 326 | searchbar43.barStyle = UIBarStyleDefault; 327 | searchbar43.clearsContextBeforeDrawing = YES; 328 | searchbar43.clipsToBounds = NO; 329 | searchbar43.contentMode = UIViewContentModeRedraw; 330 | searchbar43.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 331 | searchbar43.hidden = NO; 332 | searchbar43.multipleTouchEnabled = YES; 333 | searchbar43.opaque = NO; 334 | searchbar43.placeholder = @"type here"; 335 | searchbar43.prompt = @"search!"; 336 | searchbar43.scopeButtonTitles = [NSArray arrayWithObjects:nil]; 337 | searchbar43.showsBookmarkButton = YES; 338 | searchbar43.showsCancelButton = YES; 339 | searchbar43.showsScopeBar = NO; 340 | searchbar43.showsSearchResultsButton = NO; 341 | searchbar43.tag = 0; 342 | searchbar43.text = @"wooot!"; 343 | searchbar43.tintColor = [UIColor colorWithRed:1.000 green:0.000 blue:0.000 alpha:1.000]; 344 | searchbar43.userInteractionEnabled = YES; 345 | 346 | UITableView *tableview26 = [[UITableView alloc] initWithFrame:CGRectMake(20.0, 20.0, 253.0, 179.0) style:UITableViewStylePlain]; 347 | tableview26.frame = CGRectMake(20.0, 20.0, 253.0, 179.0); 348 | tableview26.allowsSelectionDuringEditing = NO; 349 | tableview26.alpha = 1.000; 350 | tableview26.alwaysBounceHorizontal = NO; 351 | tableview26.alwaysBounceVertical = NO; 352 | tableview26.autoresizesSubviews = YES; 353 | tableview26.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 354 | tableview26.backgroundColor = [UIColor colorWithWhite:1.000 alpha:1.000]; 355 | tableview26.bounces = YES; 356 | tableview26.bouncesZoom = NO; 357 | tableview26.canCancelContentTouches = YES; 358 | tableview26.clearsContextBeforeDrawing = NO; 359 | tableview26.clipsToBounds = YES; 360 | tableview26.contentMode = UIViewContentModeScaleToFill; 361 | tableview26.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 362 | tableview26.delaysContentTouches = YES; 363 | tableview26.directionalLockEnabled = NO; 364 | tableview26.hidden = NO; 365 | tableview26.indicatorStyle = UIScrollViewIndicatorStyleDefault; 366 | tableview26.maximumZoomScale = 1.000; 367 | tableview26.minimumZoomScale = 1.000; 368 | tableview26.multipleTouchEnabled = NO; 369 | tableview26.opaque = NO; 370 | tableview26.pagingEnabled = NO; 371 | tableview26.rowHeight = 44; 372 | tableview26.scrollEnabled = YES; 373 | tableview26.sectionFooterHeight = 22; 374 | tableview26.sectionHeaderHeight = 22; 375 | tableview26.sectionIndexMinimumDisplayRowCount = 0; 376 | tableview26.separatorStyle = UITableViewCellSeparatorStyleSingleLine; 377 | tableview26.showsHorizontalScrollIndicator = YES; 378 | tableview26.showsVerticalScrollIndicator = YES; 379 | tableview26.tag = 0; 380 | tableview26.userInteractionEnabled = YES; 381 | 382 | UITabBarItem *tabbaritem52 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemMore tag:0]; 383 | tabbaritem52.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 384 | tabbaritem52.enabled = YES; 385 | tabbaritem52.tag = 0; 386 | 387 | UIView *view35 = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 460.0)]; 388 | view35.frame = CGRectMake(0.0, 0.0, 320.0, 460.0); 389 | view35.alpha = 1.000; 390 | view35.autoresizesSubviews = YES; 391 | view35.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 392 | view35.backgroundColor = [UIColor colorWithWhite:1.000 alpha:1.000]; 393 | view35.clearsContextBeforeDrawing = NO; 394 | view35.clipsToBounds = NO; 395 | view35.contentMode = UIViewContentModeScaleToFill; 396 | view35.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 397 | view35.hidden = NO; 398 | view35.multipleTouchEnabled = NO; 399 | view35.opaque = YES; 400 | view35.tag = 0; 401 | view35.userInteractionEnabled = YES; 402 | 403 | UIActivityIndicatorView *activityindicatorview18 = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 404 | activityindicatorview18.frame = CGRectMake(48.0, 334.0, 20.0, 20.0); 405 | activityindicatorview18.alpha = 1.000; 406 | activityindicatorview18.autoresizesSubviews = YES; 407 | activityindicatorview18.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 408 | activityindicatorview18.clearsContextBeforeDrawing = NO; 409 | activityindicatorview18.clipsToBounds = NO; 410 | activityindicatorview18.contentMode = UIViewContentModeScaleToFill; 411 | activityindicatorview18.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 412 | activityindicatorview18.hidden = NO; 413 | activityindicatorview18.hidesWhenStopped = NO; 414 | activityindicatorview18.multipleTouchEnabled = NO; 415 | activityindicatorview18.opaque = NO; 416 | activityindicatorview18.tag = 0; 417 | activityindicatorview18.userInteractionEnabled = NO; 418 | [activityindicatorview18 startAnimating]; 419 | 420 | UIBarButtonItem *barbuttonitem61 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:(null) target:nil action:nil]; 421 | barbuttonitem61.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 422 | barbuttonitem61.enabled = YES; 423 | barbuttonitem61.style = UIBarButtonItemStyleBordered; 424 | barbuttonitem61.tag = 0; 425 | barbuttonitem61.title = @"Action!"; 426 | barbuttonitem61.width = 0.000; 427 | 428 | UIImageView *imageview27 = [[UIImageView alloc] initWithFrame:CGRectMake(68.0, 148.0, 240.0, 128.0)]; 429 | imageview27.frame = CGRectMake(68.0, 148.0, 240.0, 128.0); 430 | imageview27.alpha = 1.000; 431 | imageview27.autoresizesSubviews = YES; 432 | imageview27.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 433 | imageview27.clearsContextBeforeDrawing = NO; 434 | imageview27.clipsToBounds = NO; 435 | imageview27.contentMode = UIViewContentModeCenter; 436 | imageview27.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 437 | imageview27.hidden = NO; 438 | imageview27.highlighted = NO; 439 | imageview27.multipleTouchEnabled = NO; 440 | imageview27.opaque = NO; 441 | imageview27.tag = 0; 442 | imageview27.userInteractionEnabled = NO; 443 | 444 | UITabBarItem *tabbaritem53 = [[UITabBarItem alloc] initWithTabBarSystemItem:(null) tag:0]; 445 | tabbaritem53.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 446 | tabbaritem53.badgeValue = @"12"; 447 | tabbaritem53.enabled = YES; 448 | tabbaritem53.tag = 0; 449 | tabbaritem53.title = @"Item"; 450 | 451 | UIBarButtonItem *barbuttonitem62 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:nil action:nil]; 452 | barbuttonitem62.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 453 | barbuttonitem62.enabled = YES; 454 | barbuttonitem62.style = UIBarButtonItemStyleBordered; 455 | barbuttonitem62.tag = 0; 456 | barbuttonitem62.width = 0.000; 457 | 458 | UIPageControl *pagecontrol19 = [[UIPageControl alloc] initWithFrame:CGRectMake(49.0, 392.0, 38.0, 36.0)]; 459 | pagecontrol19.frame = CGRectMake(49.0, 392.0, 38.0, 36.0); 460 | pagecontrol19.alpha = 1.000; 461 | pagecontrol19.autoresizesSubviews = YES; 462 | pagecontrol19.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 463 | pagecontrol19.clearsContextBeforeDrawing = YES; 464 | pagecontrol19.clipsToBounds = YES; 465 | pagecontrol19.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 466 | pagecontrol19.contentMode = UIViewContentModeScaleToFill; 467 | pagecontrol19.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 468 | pagecontrol19.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 469 | pagecontrol19.currentPage = 0; 470 | pagecontrol19.defersCurrentPageDisplay = NO; 471 | pagecontrol19.enabled = YES; 472 | pagecontrol19.hidden = NO; 473 | pagecontrol19.hidesForSinglePage = NO; 474 | pagecontrol19.highlighted = NO; 475 | pagecontrol19.multipleTouchEnabled = YES; 476 | pagecontrol19.numberOfPages = 3; 477 | pagecontrol19.opaque = NO; 478 | pagecontrol19.selected = NO; 479 | pagecontrol19.tag = 0; 480 | pagecontrol19.userInteractionEnabled = YES; 481 | 482 | UITableViewCell *tableviewcell28 = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"reuseIdentifierString"]; 483 | tableviewcell28.frame = CGRectMake(8.0, 284.0, 320.0, 44.0); 484 | tableviewcell28.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; 485 | tableviewcell28.alpha = 1.000; 486 | tableviewcell28.autoresizesSubviews = YES; 487 | tableviewcell28.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 488 | tableviewcell28.backgroundColor = [UIColor colorWithWhite:1.000 alpha:0.000]; 489 | tableviewcell28.clearsContextBeforeDrawing = NO; 490 | tableviewcell28.clipsToBounds = NO; 491 | tableviewcell28.contentMode = UIViewContentModeScaleToFill; 492 | tableviewcell28.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 493 | tableviewcell28.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:17.000]; 494 | tableviewcell28.detailTextLabel.highlightedTextColor = [UIColor colorWithWhite:1.000 alpha:1.000]; 495 | tableviewcell28.detailTextLabel.lineBreakMode = UILineBreakModeTailTruncation; 496 | tableviewcell28.detailTextLabel.textAlignment = UITextAlignmentLeft; 497 | tableviewcell28.detailTextLabel.textColor = [UIColor colorWithRed:0.600 green:0.400 blue:0.200 alpha:1.000]; 498 | tableviewcell28.editingAccessoryType = UITableViewCellAccessoryNone; 499 | tableviewcell28.hidden = NO; 500 | tableviewcell28.indentationLevel = 0; 501 | tableviewcell28.indentationWidth = 10.000; 502 | tableviewcell28.multipleTouchEnabled = NO; 503 | tableviewcell28.opaque = NO; 504 | tableviewcell28.selectionStyle = UITableViewCellSelectionStyleBlue; 505 | tableviewcell28.shouldIndentWhileEditing = YES; 506 | tableviewcell28.showsReorderControl = NO; 507 | tableviewcell28.tag = 0; 508 | tableviewcell28.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.000]; 509 | tableviewcell28.textLabel.highlightedTextColor = [UIColor colorWithWhite:1.000 alpha:1.000]; 510 | tableviewcell28.textLabel.lineBreakMode = UILineBreakModeTailTruncation; 511 | tableviewcell28.textLabel.textAlignment = UITextAlignmentLeft; 512 | tableviewcell28.textLabel.textColor = [UIColor colorWithRed:0.600 green:0.400 blue:0.200 alpha:1.000]; 513 | tableviewcell28.userInteractionEnabled = YES; 514 | 515 | UIToolbar *toolbar63 = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0, 367.0, 320.0, 44.0)]; 516 | toolbar63.frame = CGRectMake(0.0, 367.0, 320.0, 44.0); 517 | toolbar63.alpha = 1.000; 518 | toolbar63.autoresizesSubviews = YES; 519 | toolbar63.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; 520 | toolbar63.barStyle = UIBarStyleDefault; 521 | toolbar63.clearsContextBeforeDrawing = NO; 522 | toolbar63.clipsToBounds = NO; 523 | toolbar63.contentMode = UIViewContentModeScaleToFill; 524 | toolbar63.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 525 | toolbar63.hidden = NO; 526 | toolbar63.multipleTouchEnabled = NO; 527 | toolbar63.opaque = NO; 528 | toolbar63.tag = 0; 529 | toolbar63.tintColor = [UIColor colorWithRed:0.600 green:0.400 blue:0.200 alpha:1.000]; 530 | toolbar63.userInteractionEnabled = YES; 531 | 532 | UIScrollView *scrollview29 = [[UIScrollView alloc] initWithFrame:CGRectMake(20.0, 350.0, 240.0, 90.0)]; 533 | scrollview29.frame = CGRectMake(20.0, 350.0, 240.0, 90.0); 534 | scrollview29.alpha = 1.000; 535 | scrollview29.alwaysBounceHorizontal = NO; 536 | scrollview29.alwaysBounceVertical = NO; 537 | scrollview29.autoresizesSubviews = YES; 538 | scrollview29.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin; 539 | scrollview29.bounces = YES; 540 | scrollview29.bouncesZoom = NO; 541 | scrollview29.canCancelContentTouches = YES; 542 | scrollview29.clearsContextBeforeDrawing = YES; 543 | scrollview29.clipsToBounds = YES; 544 | scrollview29.contentMode = UIViewContentModeScaleToFill; 545 | scrollview29.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 546 | scrollview29.delaysContentTouches = YES; 547 | scrollview29.directionalLockEnabled = NO; 548 | scrollview29.hidden = NO; 549 | scrollview29.indicatorStyle = UIScrollViewIndicatorStyleDefault; 550 | scrollview29.maximumZoomScale = 1.000; 551 | scrollview29.minimumZoomScale = 1.000; 552 | scrollview29.multipleTouchEnabled = YES; 553 | scrollview29.opaque = YES; 554 | scrollview29.pagingEnabled = NO; 555 | scrollview29.scrollEnabled = YES; 556 | scrollview29.showsHorizontalScrollIndicator = YES; 557 | scrollview29.showsVerticalScrollIndicator = YES; 558 | scrollview29.tag = 0; 559 | scrollview29.userInteractionEnabled = YES; 560 | 561 | UINavigationItem *navigationitem55 = [[UINavigationItem alloc] initWithTitle:@"Title"]; 562 | navigationitem55.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 563 | navigationitem55.prompt = @"prompt"; 564 | navigationitem55.title = @"Title"; 565 | 566 | NSDate *dateFromString(NSString *input) 567 | { 568 | NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 569 | [formatter setDateStyle:NSDateFormatterFullStyle]; 570 | [formatter setTimeStyle:NSDateFormatterFullStyle]; 571 | NSDate *date = [formatter dateFromString:input]; 572 | return date; 573 | } 574 | 575 | UIDatePicker *datepicker38 = [[UIDatePicker alloc] initWithFrame:CGRectMake(0.0, 244.0, 320.0, 216.0)]; 576 | datepicker38.frame = CGRectMake(0.0, 244.0, 320.0, 216.0); 577 | datepicker38.alpha = 1.000; 578 | datepicker38.autoresizesSubviews = YES; 579 | datepicker38.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 580 | datepicker38.clearsContextBeforeDrawing = YES; 581 | datepicker38.clipsToBounds = YES; 582 | datepicker38.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 583 | datepicker38.contentMode = UIViewContentModeScaleToFill; 584 | datepicker38.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 585 | datepicker38.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 586 | datepicker38.countDownDuration = 0; 587 | datepicker38.date = dateFromString(@"Monday, October 27, 2008 2:00:00 AM Switzerland Time"); 588 | datepicker38.datePickerMode = UIDatePickerModeDateAndTime; 589 | datepicker38.enabled = YES; 590 | datepicker38.hidden = NO; 591 | datepicker38.highlighted = NO; 592 | datepicker38.locale = nil; 593 | datepicker38.maximumDate = dateFromString(@"Thursday, December 31, 2037 12:00:00 PM Switzerland Time"); 594 | datepicker38.minimumDate = dateFromString(@"Thursday, January 1, 1970 12:00:00 PM Switzerland Time"); 595 | datepicker38.minuteInterval = 5; 596 | datepicker38.multipleTouchEnabled = YES; 597 | datepicker38.opaque = NO; 598 | datepicker38.selected = NO; 599 | datepicker38.tag = 0; 600 | datepicker38.userInteractionEnabled = YES; 601 | 602 | UIBarButtonItem *barbuttonitem64 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:(null) target:nil action:nil]; 603 | barbuttonitem64.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 604 | barbuttonitem64.enabled = YES; 605 | barbuttonitem64.style = UIBarButtonItemStyleBordered; 606 | barbuttonitem64.tag = 0; 607 | barbuttonitem64.title = @"Item"; 608 | barbuttonitem64.width = 0.000; 609 | 610 | UIWebView *webview39 = [[UIWebView alloc] initWithFrame:CGRectMake(20.0, 26.0, 240.0, 128.0)]; 611 | webview39.frame = CGRectMake(20.0, 26.0, 240.0, 128.0); 612 | webview39.alpha = 1.000; 613 | webview39.autoresizesSubviews = YES; 614 | webview39.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 615 | webview39.backgroundColor = [UIColor colorWithRed:1.000 green:1.000 blue:1.000 alpha:1.000]; 616 | webview39.clearsContextBeforeDrawing = YES; 617 | webview39.clipsToBounds = YES; 618 | webview39.contentMode = UIViewContentModeScaleToFill; 619 | webview39.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 620 | webview39.hidden = NO; 621 | webview39.multipleTouchEnabled = YES; 622 | webview39.opaque = YES; 623 | webview39.scalesPageToFit = YES; 624 | webview39.tag = 0; 625 | webview39.userInteractionEnabled = YES; 626 | 627 | UIBarButtonItem *barbuttonitem65 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 628 | barbuttonitem65.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 629 | barbuttonitem65.enabled = YES; 630 | barbuttonitem65.style = UIBarButtonItemStylePlain; 631 | barbuttonitem65.tag = 0; 632 | barbuttonitem65.width = 0.000; 633 | 634 | UIBarButtonItem *barbuttonitem66 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; 635 | barbuttonitem66.frame = CGRectMake(0.0, 0.0, 0.0, 0.0); 636 | barbuttonitem66.enabled = YES; 637 | barbuttonitem66.style = UIBarButtonItemStylePlain; 638 | barbuttonitem66.tag = 0; 639 | barbuttonitem66.width = 42.000; 640 | 641 | UILabel *label10 = [[UILabel alloc] initWithFrame:CGRectMake(106.0, 181.0, 155.0, 21.0)]; 642 | label10.frame = CGRectMake(106.0, 181.0, 155.0, 21.0); 643 | label10.adjustsFontSizeToFitWidth = YES; 644 | label10.alpha = 1.000; 645 | label10.autoresizesSubviews = YES; 646 | label10.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 647 | label10.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.000]; 648 | label10.baselineAdjustment = UIBaselineAdjustmentAlignCenters; 649 | label10.clearsContextBeforeDrawing = YES; 650 | label10.clipsToBounds = YES; 651 | label10.contentMode = UIViewContentModeScaleToFill; 652 | label10.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 653 | label10.enabled = YES; 654 | label10.font = [UIFont fontWithName:@"Helvetica" size:17.000]; 655 | label10.hidden = NO; 656 | label10.highlightedTextColor = [UIColor colorWithRed:0.000 green:1.000 blue:0.000 alpha:1.000]; 657 | label10.lineBreakMode = UILineBreakModeTailTruncation; 658 | label10.minimumFontSize = 10.000; 659 | label10.multipleTouchEnabled = NO; 660 | label10.numberOfLines = 1; 661 | label10.opaque = NO; 662 | label10.shadowColor = [UIColor colorWithRed:1.000 green:0.500 blue:0.000 alpha:1.000]; 663 | label10.shadowOffset = CGSizeMake(59.0, 2.0); 664 | label10.tag = 0; 665 | label10.text = @"Label"; 666 | label10.textAlignment = UITextAlignmentLeft; 667 | label10.textColor = [UIColor colorWithRed:0.000 green:0.000 blue:0.000 alpha:1.000]; 668 | label10.userInteractionEnabled = NO; 669 | 670 | UIProgressView *progressview11 = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; 671 | progressview11.frame = CGRectMake(52.0, 259.0, 150.0, 9.0); 672 | progressview11.alpha = 1.000; 673 | progressview11.autoresizesSubviews = YES; 674 | progressview11.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 675 | progressview11.clearsContextBeforeDrawing = YES; 676 | progressview11.clipsToBounds = YES; 677 | progressview11.contentMode = UIViewContentModeScaleToFill; 678 | progressview11.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 679 | progressview11.hidden = NO; 680 | progressview11.multipleTouchEnabled = YES; 681 | progressview11.opaque = NO; 682 | progressview11.progress = 0.500; 683 | progressview11.progressViewStyle = UIProgressViewStyleDefault; 684 | progressview11.tag = 0; 685 | progressview11.userInteractionEnabled = YES; 686 | 687 | UISegmentedControl *segmentedcontrol20 = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"First", @"Second", nil]]; 688 | segmentedcontrol20.frame = CGRectMake(60.0, 125.0, 207.0, 44.0); 689 | segmentedcontrol20.alpha = 1.000; 690 | segmentedcontrol20.autoresizesSubviews = YES; 691 | segmentedcontrol20.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 692 | segmentedcontrol20.clearsContextBeforeDrawing = NO; 693 | segmentedcontrol20.clipsToBounds = NO; 694 | segmentedcontrol20.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; 695 | segmentedcontrol20.contentMode = UIViewContentModeScaleToFill; 696 | segmentedcontrol20.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); 697 | segmentedcontrol20.contentVerticalAlignment = UIControlContentVerticalAlignmentTop; 698 | segmentedcontrol20.enabled = YES; 699 | segmentedcontrol20.hidden = NO; 700 | segmentedcontrol20.highlighted = NO; 701 | segmentedcontrol20.momentary = NO; 702 | segmentedcontrol20.multipleTouchEnabled = NO; 703 | segmentedcontrol20.opaque = NO; 704 | segmentedcontrol20.segmentedControlStyle = UISegmentedControlStylePlain; 705 | segmentedcontrol20.selected = NO; 706 | segmentedcontrol20.selectedSegmentIndex = 0; 707 | segmentedcontrol20.tag = 0; 708 | segmentedcontrol20.userInteractionEnabled = YES; 709 | 710 | [view6 addSubview:textfield8]; 711 | [view6 addSubview:label10]; 712 | [view6 addSubview:progressview11]; 713 | [view6 addSubview:button9]; 714 | [view14 addSubview:slider12]; 715 | [view14 addSubview:switch13]; 716 | [view6 addSubview:view14]; 717 | [view6 addSubview:activityindicatorview18]; 718 | [view6 addSubview:pagecontrol19]; 719 | [view6 addSubview:segmentedcontrol20]; 720 | [view23 addSubview:tableview25]; 721 | [view23 addSubview:tableview26]; 722 | [view23 addSubview:imageview27]; 723 | [view23 addSubview:scrollview29]; 724 | [view23 addSubview:tableviewcell28]; 725 | [view32 addSubview:textview33]; 726 | [view32 addSubview:pickerview34]; 727 | [view35 addSubview:datepicker38]; 728 | [view35 addSubview:webview39]; 729 | [navigationitem55 addSubview:barbuttonitem61]; 730 | [navigationitem55 addSubview:barbuttonitem62]; 731 | [navigationbar41 addSubview:navigationitem55]; 732 | [view40 addSubview:navigationbar41]; 733 | [tabbar50 addSubview:tabbaritem51]; 734 | [tabbar50 addSubview:tabbaritem52]; 735 | [tabbar50 addSubview:tabbaritem53]; 736 | [view40 addSubview:tabbar50]; 737 | [view40 addSubview:searchbar43]; 738 | [toolbar63 addSubview:barbuttonitem64]; 739 | [toolbar63 addSubview:barbuttonitem65]; 740 | [toolbar63 addSubview:barbuttonitem66]; 741 | [view40 addSubview:toolbar63]; 742 | -------------------------------------------------------------------------------- /Sample/sample.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | xcodebuild 3 | build/Release/nib2objc TestViewController.xib > sample.m 4 | git add sample.m 5 | git commit -m "New run of the sample.sh script" 6 | --------------------------------------------------------------------------------