diff options
Diffstat (limited to 'examples/cross_calculator')
-rw-r--r-- | examples/cross_calculator/ios/cross-calculator.xcodeproj/project.pbxproj | 14 | ||||
-rw-r--r-- | examples/cross_calculator/ios/resources/ui/NRViewController.xib (renamed from examples/cross_calculator/ios/src/NRViewController.xib) | 166 | ||||
-rw-r--r-- | examples/cross_calculator/ios/src/NRViewController.m | 168 |
3 files changed, 231 insertions, 117 deletions
diff --git a/examples/cross_calculator/ios/cross-calculator.xcodeproj/project.pbxproj b/examples/cross_calculator/ios/cross-calculator.xcodeproj/project.pbxproj index b45e57dbd..36b43d31b 100644 --- a/examples/cross_calculator/ios/cross-calculator.xcodeproj/project.pbxproj +++ b/examples/cross_calculator/ios/cross-calculator.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ D531427215BC94B1005EFF20 /* backend.m in Sources */ = {isa = PBXBuildFile; fileRef = D531426F15BC94B1005EFF20 /* backend.m */; }; D531427415BC94B1005EFF20 /* system.m in Sources */ = {isa = PBXBuildFile; fileRef = D531427115BC94B1005EFF20 /* system.m */; }; D5B6F94815FA8D4C0084A85B /* NRViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5B6F94615FA8D4C0084A85B /* NRViewController.m */; }; - D5B6F94915FA8D4C0084A85B /* NRViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5B6F94715FA8D4C0084A85B /* NRViewController.xib */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -36,7 +35,7 @@ D592E19115C71415005258EA /* nimbase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nimbase.h; path = build/nimcache/nimbase.h; sourceTree = "<group>"; }; D5B6F94515FA8D4C0084A85B /* NRViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NRViewController.h; path = src/NRViewController.h; sourceTree = "<group>"; }; D5B6F94615FA8D4C0084A85B /* NRViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NRViewController.m; path = src/NRViewController.m; sourceTree = "<group>"; }; - D5B6F94715FA8D4C0084A85B /* NRViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = NRViewController.xib; path = src/NRViewController.xib; sourceTree = "<group>"; }; + D5B6F96315FB448D0084A85B /* NRViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = NRViewController.xib; path = resources/ui/NRViewController.xib; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -87,6 +86,7 @@ isa = PBXGroup; children = ( D531424615BC8756005EFF20 /* plist */, + D5B6F96115FB447C0084A85B /* ui */, ); name = resources; sourceTree = "<group>"; @@ -108,7 +108,6 @@ D531424B15BC87B6005EFF20 /* main.m */, D5B6F94515FA8D4C0084A85B /* NRViewController.h */, D5B6F94615FA8D4C0084A85B /* NRViewController.m */, - D5B6F94715FA8D4C0084A85B /* NRViewController.xib */, ); name = src; sourceTree = "<group>"; @@ -141,6 +140,14 @@ name = nimrod; sourceTree = "<group>"; }; + D5B6F96115FB447C0084A85B /* ui */ = { + isa = PBXGroup; + children = ( + D5B6F96315FB448D0084A85B /* NRViewController.xib */, + ); + name = ui; + sourceTree = "<group>"; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -193,7 +200,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D5B6F94915FA8D4C0084A85B /* NRViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/examples/cross_calculator/ios/src/NRViewController.xib b/examples/cross_calculator/ios/resources/ui/NRViewController.xib index 3bf069b5e..b260db2af 100644 --- a/examples/cross_calculator/ios/src/NRViewController.xib +++ b/examples/cross_calculator/ios/resources/ui/NRViewController.xib @@ -37,6 +37,40 @@ <reference key="NSNextResponder"/> <int key="NSvFlags">274</int> <array class="NSMutableArray" key="NSSubviews"> + <object class="IBUIButton" id="467453084"> + <reference key="NSNextResponder" ref="191373211"/> + <int key="NSvFlags">292</int> + <string key="NSFrame">{{0, -10}, {320, 480}}</string> + <reference key="NSSuperview" ref="191373211"/> + <reference key="NSWindow"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <bool key="IBUIOpaque">NO</bool> + <int key="IBUITag">1</int> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + <int key="IBUIContentHorizontalAlignment">0</int> + <int key="IBUIContentVerticalAlignment">0</int> + <object class="NSColor" key="IBUIHighlightedTitleColor" id="95215378"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + <object class="NSColor" key="IBUINormalTitleColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes> + </object> + <object class="NSColor" key="IBUINormalTitleShadowColor" id="1056499111"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC41AA</bytes> + </object> + <object class="IBUIFontDescription" key="IBUIFontDescription" id="686052398"> + <int key="type">2</int> + <double key="pointSize">15</double> + </object> + <object class="NSFont" key="IBUIFont" id="594372787"> + <string key="NSName">Helvetica-Bold</string> + <double key="NSSize">15</double> + <int key="NSfFlags">16</int> + </object> + </object> <object class="IBUILabel" id="353054360"> <reference key="NSNextResponder" ref="191373211"/> <int key="NSvFlags">306</int> @@ -48,6 +82,7 @@ <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> <int key="IBUIContentMode">7</int> + <int key="IBUITag">2</int> <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <string key="IBUIText">Nimrod Crossplatform Calculator</string> @@ -80,6 +115,7 @@ <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> <int key="IBUIContentMode">7</int> + <int key="IBUITag">3</int> <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <string key="IBUIText">Value A:</string> @@ -108,6 +144,7 @@ <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> <int key="IBUIContentMode">7</int> + <int key="IBUITag">4</int> <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <string key="IBUIText">Value B:</string> @@ -127,32 +164,20 @@ <reference key="NSNextKeyView"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> + <int key="IBUITag">5</int> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <int key="IBUIContentHorizontalAlignment">0</int> <int key="IBUIContentVerticalAlignment">0</int> <int key="IBUIButtonType">1</int> <string key="IBUINormalTitle">Add!</string> - <object class="NSColor" key="IBUIHighlightedTitleColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MQA</bytes> - </object> + <reference key="IBUIHighlightedTitleColor" ref="95215378"/> <object class="NSColor" key="IBUINormalTitleColor"> <int key="NSColorSpace">1</int> <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes> </object> - <object class="NSColor" key="IBUINormalTitleShadowColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC41AA</bytes> - </object> - <object class="IBUIFontDescription" key="IBUIFontDescription"> - <int key="type">2</int> - <double key="pointSize">15</double> - </object> - <object class="NSFont" key="IBUIFont"> - <string key="NSName">Helvetica-Bold</string> - <double key="NSSize">15</double> - <int key="NSfFlags">16</int> - </object> + <reference key="IBUINormalTitleShadowColor" ref="1056499111"/> + <reference key="IBUIFontDescription" ref="686052398"/> + <reference key="IBUIFont" ref="594372787"/> </object> <object class="IBUILabel" id="360864196"> <reference key="NSNextResponder" ref="191373211"/> @@ -165,6 +190,7 @@ <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> <int key="IBUIContentMode">7</int> + <int key="IBUITag">6</int> <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <string key="IBUIText">Result:</string> @@ -186,6 +212,7 @@ <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> <int key="IBUIContentMode">7</int> + <int key="IBUITag">7</int> <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <string key="IBUIText"/> @@ -206,6 +233,7 @@ <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> + <int key="IBUITag">8</int> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <int key="IBUIContentVerticalAlignment">0</int> <string key="IBUIText"/> @@ -246,6 +274,7 @@ <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> + <int key="IBUITag">9</int> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <int key="IBUIContentVerticalAlignment">0</int> <string key="IBUIText"/> @@ -282,66 +311,7 @@ </object> </array> <object class="IBObjectContainer" key="IBDocument.Objects"> - <array class="NSMutableArray" key="connectionRecords"> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">view</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="191373211"/> - </object> - <int key="connectionID">3</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">resultLabel</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="521073831"/> - </object> - <int key="connectionID">15</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">calculateButton</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="557594991"/> - </object> - <int key="connectionID">16</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">aText</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="1040444341"/> - </object> - <int key="connectionID">17</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">bText</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="1041721572"/> - </object> - <int key="connectionID">18</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchEventConnection" key="connection"> - <string key="label">backgroundTouched</string> - <reference key="source" ref="191373211"/> - <reference key="destination" ref="372490531"/> - <int key="IBEventType">7</int> - </object> - <int key="connectionID">20</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchEventConnection" key="connection"> - <string key="label">calculateButtonTouched</string> - <reference key="source" ref="557594991"/> - <reference key="destination" ref="372490531"/> - <int key="IBEventType">7</int> - </object> - <int key="connectionID">21</int> - </object> - </array> + <array class="NSMutableArray" key="connectionRecords"/> <object class="IBMutableOrderedSet" key="objectRecords"> <array key="orderedObjects"> <object class="IBObjectRecord"> @@ -362,6 +332,7 @@ <reference ref="521073831"/> <reference ref="1040444341"/> <reference ref="1041721572"/> + <reference ref="467453084"/> </array> <reference key="parent" ref="0"/> </object> @@ -377,18 +348,23 @@ <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> - <int key="objectID">4</int> - <reference key="object" ref="353054360"/> + <int key="objectID">14</int> + <reference key="object" ref="1041721572"/> <reference key="parent" ref="191373211"/> </object> <object class="IBObjectRecord"> - <int key="objectID">7</int> - <reference key="object" ref="525225214"/> + <int key="objectID">13</int> + <reference key="object" ref="1040444341"/> <reference key="parent" ref="191373211"/> </object> <object class="IBObjectRecord"> - <int key="objectID">8</int> - <reference key="object" ref="904781109"/> + <int key="objectID">12</int> + <reference key="object" ref="521073831"/> + <reference key="parent" ref="191373211"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">11</int> + <reference key="object" ref="360864196"/> <reference key="parent" ref="191373211"/> </object> <object class="IBObjectRecord"> @@ -397,23 +373,23 @@ <reference key="parent" ref="191373211"/> </object> <object class="IBObjectRecord"> - <int key="objectID">11</int> - <reference key="object" ref="360864196"/> + <int key="objectID">8</int> + <reference key="object" ref="904781109"/> <reference key="parent" ref="191373211"/> </object> <object class="IBObjectRecord"> - <int key="objectID">12</int> - <reference key="object" ref="521073831"/> + <int key="objectID">7</int> + <reference key="object" ref="525225214"/> <reference key="parent" ref="191373211"/> </object> <object class="IBObjectRecord"> - <int key="objectID">13</int> - <reference key="object" ref="1040444341"/> + <int key="objectID">4</int> + <reference key="object" ref="353054360"/> <reference key="parent" ref="191373211"/> </object> <object class="IBObjectRecord"> - <int key="objectID">14</int> - <reference key="object" ref="1041721572"/> + <int key="objectID">22</int> + <reference key="object" ref="467453084"/> <reference key="parent" ref="191373211"/> </object> </array> @@ -423,13 +399,13 @@ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="-2.CustomClassName">UIResponder</string> <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="1.CustomClassName">UIControl</string> <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="22.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> @@ -438,7 +414,7 @@ <nil key="activeLocalization"/> <dictionary class="NSMutableDictionary" key="localizations"/> <nil key="sourceID"/> - <int key="maxID">21</int> + <int key="maxID">22</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <array class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -496,10 +472,6 @@ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string> <real value="0.0" key="NS.object.0"/> </object> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string> - <real value="1296" key="NS.object.0"/> - </object> <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <int key="IBDocument.defaultPropertyAccessControl">3</int> <string key="IBCocoaTouchPluginVersion">1498</string> diff --git a/examples/cross_calculator/ios/src/NRViewController.m b/examples/cross_calculator/ios/src/NRViewController.m index 03b2548ad..bd0df7d6b 100644 --- a/examples/cross_calculator/ios/src/NRViewController.m +++ b/examples/cross_calculator/ios/src/NRViewController.m @@ -10,22 +10,6 @@ @synthesize calculateButton = _calculateButton; @synthesize resultLabel = _resultLabel; -/** We need no special custom initialization for this example. - * Note that this example project has been made to deploy only on iOS 4.x - * upwards because the currently available Xcode tools are incapable of - * generating iOS 3.x backwards compatible NIB files. If your device is 3.x - * only you can replace the NIM with UI construction in code and everything - * else should be fine. - */ -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - } - return self; -} - - (void)dealloc { [_aText release]; @@ -71,4 +55,156 @@ [self.bText resignFirstResponder]; } +/** Custom loadView method for backwards compatiblity. + * Unfortunately I've been unable to coerce Xcode 4.4 to generate nib files + * which are compatible with my trusty iOS 3.0 ipod touch so in order to be + * fully compatible for all devices we have to build the interface manually in + * code rather than through the keyed archivers provided by the interface + * builder. + * + * Rather than recreating the user interface manually in code the tool nib2obj + * was used on the xib file and slightly modified to fit the original property + * names. Which means here is a lot of garbage you would never write in real + * life. Please ignore the following "wall of code" for the purposes of + * learning Nimrod, this is all just because Apple can't be bothered to + * maintain backwards compatibility properly. + */ +- (void)loadView +{ + [super loadView]; + + self.calculateButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; + self.calculateButton.autoresizesSubviews = YES; + self.calculateButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; + self.calculateButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; + self.calculateButton.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + self.calculateButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; + self.calculateButton.frame = CGRectMake(193.0, 124.0, 107.0, 37.0); + self.calculateButton.tag = 5; + [self.calculateButton setTitle:@"Add!" forState:UIControlStateNormal]; + [self.calculateButton addTarget:self + action:@selector(calculateButtonTouched) + forControlEvents:UIControlEventTouchUpInside]; + + UILabel *label11 = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 124.0, 60.0, 37.0)]; + label11.adjustsFontSizeToFitWidth = YES; + label11.autoresizesSubviews = YES; + label11.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; + label11.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + label11.frame = CGRectMake(20.0, 124.0, 60.0, 37.0); + label11.tag = 6; + label11.text = @"Result:"; + + UILabel *label4 = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 34.0)]; + label4.adjustsFontSizeToFitWidth = YES; + label4.autoresizesSubviews = YES; + label4.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin; + label4.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + label4.frame = CGRectMake(0.0, 0.0, 320.0, 34.0); + label4.tag = 2; + label4.text = @"Nimrod Crossplatform Calculator"; + label4.textAlignment = UITextAlignmentCenter; + + UIButton *background_button = [UIButton buttonWithType:UIButtonTypeCustom]; + background_button.autoresizesSubviews = YES; + background_button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; + background_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; + background_button.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + background_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; + background_button.frame = CGRectMake(0.0, -10.0, 320.0, 480.0); + background_button.tag = 1; + [background_button addTarget:self action:@selector(backgroundTouched) + forControlEvents:UIControlEventTouchDown]; + + self.resultLabel = [[[UILabel alloc] initWithFrame:CGRectMake(88.0, 124.0, 97.0, 37.0)] autorelease]; + self.resultLabel.adjustsFontSizeToFitWidth = YES; + self.resultLabel.autoresizesSubviews = YES; + self.resultLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; + self.resultLabel.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + self.resultLabel.frame = CGRectMake(88.0, 124.0, 97.0, 37.0); + self.resultLabel.tag = 7; + self.resultLabel.text = @""; + + self.aText = [[[UITextField alloc] initWithFrame:CGRectMake(193.0, 42.0, 107.0, 31.0)] autorelease]; + self.aText.adjustsFontSizeToFitWidth = YES; + self.aText.autocapitalizationType = UITextAutocapitalizationTypeNone; + self.aText.autocorrectionType = UITextAutocorrectionTypeDefault; + self.aText.autoresizesSubviews = YES; + self.aText.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; + self.aText.borderStyle = UITextBorderStyleRoundedRect; + self.aText.clearButtonMode = UITextFieldViewModeWhileEditing; + self.aText.clearsOnBeginEditing = NO; + self.aText.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + self.aText.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + self.aText.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; + self.aText.enablesReturnKeyAutomatically = NO; + self.aText.frame = CGRectMake(193.0, 42.0, 107.0, 31.0); + self.aText.keyboardAppearance = UIKeyboardAppearanceDefault; + self.aText.keyboardType = UIKeyboardTypeNumberPad; + self.aText.placeholder = @"Integer"; + self.aText.returnKeyType = UIReturnKeyDefault; + self.aText.tag = 8; + self.aText.text = @""; + self.aText.textAlignment = UITextAlignmentCenter; + + UILabel *label7 = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 42.0, 165.0, 31.0)]; + label7.adjustsFontSizeToFitWidth = YES; + label7.autoresizesSubviews = YES; + label7.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; + label7.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + label7.frame = CGRectMake(20.0, 42.0, 165.0, 31.0); + label7.tag = 3; + label7.text = @"Value A:"; + + UILabel *label8 = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 81.0, 165.0, 31.0)]; + label8.adjustsFontSizeToFitWidth = YES; + label8.autoresizesSubviews = YES; + label8.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; + label8.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + label8.frame = CGRectMake(20.0, 81.0, 165.0, 31.0); + label8.tag = 4; + label8.text = @"Value B:"; + + self.bText = [[[UITextField alloc] + initWithFrame:CGRectMake(193.0, 81.0, 107.0, 31.0)] autorelease]; + self.bText.adjustsFontSizeToFitWidth = YES; + self.bText.autocapitalizationType = UITextAutocapitalizationTypeNone; + self.bText.autocorrectionType = UITextAutocorrectionTypeDefault; + self.bText.autoresizesSubviews = YES; + self.bText.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; + self.bText.borderStyle = UITextBorderStyleRoundedRect; + self.bText.clearButtonMode = UITextFieldViewModeWhileEditing; + self.bText.clearsOnBeginEditing = NO; + self.bText.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + self.bText.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + self.bText.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; + self.bText.enablesReturnKeyAutomatically = NO; + self.bText.frame = CGRectMake(193.0, 81.0, 107.0, 31.0); + self.bText.keyboardAppearance = UIKeyboardAppearanceDefault; + self.bText.keyboardType = UIKeyboardTypeNumberPad; + self.bText.placeholder = @"Integer"; + self.bText.returnKeyType = UIReturnKeyDefault; + self.bText.tag = 9; + self.bText.text = @""; + self.bText.textAlignment = UITextAlignmentCenter; + + self.view.frame = CGRectMake(0.0, 20.0, 320.0, 460.0); + self.view.autoresizesSubviews = YES; + self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.view.backgroundColor = [UIColor colorWithWhite:1.000 alpha:1.000]; + self.view.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); + self.view.frame = CGRectMake(0.0, 20.0, 320.0, 460.0); + self.view.tag = 0; + + [self.view addSubview:background_button]; + [self.view addSubview:label4]; + [self.view addSubview:label7]; + [self.view addSubview:label8]; + [self.view addSubview:self.calculateButton]; + [self.view addSubview:label11]; + [self.view addSubview:self.resultLabel]; + [self.view addSubview:self.aText]; + [self.view addSubview:self.bText]; +} + @end |