Permalink
Browse files

Finished Cocoa. Added First.

  • Loading branch information...
swannodette committed Nov 5, 2009
1 parent e2426c3 commit a82c47fafab36576c65ceac7d9013cef2672b2a3
View
@@ -10,9 +10,14 @@
@interface CocoaAppDelegate : NSObject <NSApplicationDelegate>
{
- NSWindow *window;
+ NSWindow *window;
+ IBOutlet NSButton *createLotsButon;
+ IBOutlet NSButton *createLotsBetterButton;
}
@property (assign) IBOutlet NSWindow *window;
+- (IBAction) createLotsOfObjects:(id)sender;
+- (IBAction) createLotsOfObjectsBetter:(id)sender;
+
@end
View
@@ -17,4 +17,20 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
// Insert code here to initialize your application
}
+- (IBAction) createLotsOfObjects:(id)sender
+{
+ for (int i = 0; i < 100000; i++) {
+ NSDictionary *d = [NSDictionary dictionaryWithObjectsAndKeys:@"bar", @"foo", nil];
+ }
+}
+
+- (IBAction) createLotsOfObjectsBetter:(id)sender
+{
+ for (int i = 0; i < 100000; i++) {
+ NSDictionary *d = [NSDictionary new];
+ [d setValue:@"bar" forKey:@"foo"];
+ [d release];
+ }
+}
+
@end
@@ -13,7 +13,7 @@
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="29"/>
- <integer value="372"/>
+ <integer value="371"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2070,6 +2070,38 @@
</object>
<int key="connectionID">532</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">createLotsOfObjects:</string>
+ <reference key="source" ref="976324537"/>
+ <reference key="destination" ref="111676910"/>
+ </object>
+ <int key="connectionID">539</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">createLotsOfObjectsBetter:</string>
+ <reference key="source" ref="976324537"/>
+ <reference key="destination" ref="126176391"/>
+ </object>
+ <int key="connectionID">540</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">createLotsButon</string>
+ <reference key="source" ref="976324537"/>
+ <reference key="destination" ref="111676910"/>
+ </object>
+ <int key="connectionID">541</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">createLotsBetterButton</string>
+ <reference key="source" ref="976324537"/>
+ <reference key="destination" ref="126176391"/>
+ </object>
+ <int key="connectionID">542</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -3511,7 +3543,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{525, 802}, {197, 73}}</string>
- <string>{{53, 781}, {408, 20}}</string>
+ <string>{{47, 691}, {408, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{74, 862}</string>
@@ -3536,9 +3568,9 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{359, 639}, {285, 92}}</string>
+ <string>{{355, 563}, {285, 92}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{359, 639}, {285, 92}}</string>
+ <string>{{355, 563}, {285, 92}}</string>
<integer value="1"/>
<string>{{33, 99}, {480, 360}}</string>
<string>{3.40282e+38, 3.40282e+38}</string>
@@ -3679,17 +3711,41 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">536</int>
+ <int key="maxID">542</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">CocoaAppDelegate</string>
<string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>createLotsOfObjects:</string>
+ <string>createLotsOfObjectsBetter:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
<object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">window</string>
- <string key="NS.object.0">NSWindow</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>createLotsBetterButton</string>
+ <string>createLotsButon</string>
+ <string>window</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSWindow</string>
+ </object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
@@ -0,0 +1,22 @@
+//
+// FirstAppDelegate.h
+// First
+//
+// Created by David Nolen on 11/5/09.
+// Copyright David Nolen 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class FirstViewController;
+
+@interface FirstAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ FirstViewController *viewController;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet FirstViewController *viewController;
+
+@end
+
@@ -0,0 +1,32 @@
+//
+// FirstAppDelegate.m
+// First
+//
+// Created by David Nolen on 11/5/09.
+// Copyright David Nolen 2009. All rights reserved.
+//
+
+#import "FirstAppDelegate.h"
+#import "FirstViewController.h"
+
+@implementation FirstAppDelegate
+
+@synthesize window;
+@synthesize viewController;
+
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+
+ // Override point for customization after app launch
+ [window addSubview:viewController.view];
+ [window makeKeyAndVisible];
+}
+
+- (void)dealloc {
+ [viewController release];
+ [window release];
+ [super dealloc];
+}
+
+
+@end
@@ -0,0 +1,21 @@
+//
+// FirstViewController.h
+// First
+//
+// Created by David Nolen on 11/5/09.
+// Copyright David Nolen 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface FirstViewController : UIViewController <UITextFieldDelegate>
+{
+ IBOutlet UIButton *button;
+ IBOutlet UILabel *label;
+ IBOutlet UITextField *input;
+}
+
+- (IBAction)sayHello:(id)sender;
+
+@end
+
@@ -0,0 +1,46 @@
+//
+// FirstViewController.m
+// First
+//
+// Created by David Nolen on 11/5/09.
+// Copyright David Nolen 2009. All rights reserved.
+//
+
+#import "FirstViewController.h"
+
+@implementation FirstViewController
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+}
+
+- (IBAction)sayHello:(id)sender
+{
+ label.text = @"Hello world!";
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+}
+
+- (void)viewDidUnload
+{
+}
+
+- (BOOL)textFieldShouldReturn:(UITextField *)aInput
+{
+ if (aInput == input)
+ {
+ [input resignFirstResponder];
+ }
+ return YES;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
View
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+</dict>
+</plist>
Oops, something went wrong.

0 comments on commit a82c47f

Please sign in to comment.