Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

第12章 UINavigationController

  • Loading branch information...
commit 6b4c17a53fe2f0ae348d8ad6c877f8038be93f00 1 parent 61d3411
@kentaro authored
View
12 Homepwner/Homepwner.xcodeproj/project.pbxproj
@@ -23,6 +23,8 @@
96B1CC1E14F8C6D300961BA6 /* PossessionStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 96B1CC1D14F8C6D200961BA6 /* PossessionStore.m */; };
96B1CC2114F8CAB700961BA6 /* Possession.m in Sources */ = {isa = PBXBuildFile; fileRef = 96B1CC2014F8CAB700961BA6 /* Possession.m */; };
96B1CC2314F9149B00961BA6 /* HeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 96B1CC2214F9149B00961BA6 /* HeaderView.xib */; };
+ 96FE849F150EBA33002A2946 /* ItemDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 96FE849D150EBA33002A2946 /* ItemDetailViewController.m */; };
+ 96FE84A0150EBA33002A2946 /* ItemDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 96FE849E150EBA33002A2946 /* ItemDetailViewController.xib */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -60,6 +62,9 @@
96B1CC1F14F8CAB700961BA6 /* Possession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Possession.h; sourceTree = "<group>"; };
96B1CC2014F8CAB700961BA6 /* Possession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Possession.m; sourceTree = "<group>"; };
96B1CC2214F9149B00961BA6 /* HeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HeaderView.xib; sourceTree = "<group>"; };
+ 96FE849C150EBA33002A2946 /* ItemDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ItemDetailViewController.h; sourceTree = "<group>"; };
+ 96FE849D150EBA33002A2946 /* ItemDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ItemDetailViewController.m; sourceTree = "<group>"; };
+ 96FE849E150EBA33002A2946 /* ItemDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ItemDetailViewController.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -123,6 +128,9 @@
96B1CBF114F8C0F800961BA6 /* HomepwnerAppDelegate.m */,
96B1CC1914F8C4E200961BA6 /* ItemsViewController.h */,
96B1CC1A14F8C4E200961BA6 /* ItemsViewController.m */,
+ 96FE849C150EBA33002A2946 /* ItemDetailViewController.h */,
+ 96FE849D150EBA33002A2946 /* ItemDetailViewController.m */,
+ 96FE849E150EBA33002A2946 /* ItemDetailViewController.xib */,
96B1CBF314F8C0F800961BA6 /* MainStoryboard.storyboard */,
96B1CC2214F9149B00961BA6 /* HeaderView.xib */,
96B1CC1F14F8CAB700961BA6 /* Possession.h */,
@@ -237,6 +245,7 @@
96B1CBEC14F8C0F800961BA6 /* InfoPlist.strings in Resources */,
96B1CBF514F8C0F800961BA6 /* MainStoryboard.storyboard in Resources */,
96B1CC2314F9149B00961BA6 /* HeaderView.xib in Resources */,
+ 96FE84A0150EBA33002A2946 /* ItemDetailViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -276,6 +285,7 @@
96B1CC1B14F8C4E200961BA6 /* ItemsViewController.m in Sources */,
96B1CC1E14F8C6D300961BA6 /* PossessionStore.m in Sources */,
96B1CC2114F8CAB700961BA6 /* Possession.m in Sources */,
+ 96FE849F150EBA33002A2946 /* ItemDetailViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -445,6 +455,7 @@
96B1CC1214F8C0F800961BA6 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
96B1CC1314F8C0F800961BA6 /* Build configuration list for PBXNativeTarget "HomepwnerTests" */ = {
isa = XCConfigurationList;
@@ -453,6 +464,7 @@
96B1CC1514F8C0F800961BA6 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
View
4 Homepwner/Homepwner/HomepwnerAppDelegate.m
@@ -17,7 +17,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
{
ItemsViewController *itemsViewController = [[ItemsViewController alloc] init];
- [self.window setRootViewController:itemsViewController];
+ UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:itemsViewController];
+
+ [self.window setRootViewController:navController];
return YES;
}
View
21 Homepwner/Homepwner/ItemDetailViewController.h
@@ -0,0 +1,21 @@
+//
+// ItemDetailViewController.h
+// Homepwner
+//
+// Created by 栗林健太郎 on 3/13/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "Possession.h"
+
+@interface ItemDetailViewController : UIViewController
+<UINavigationControllerDelegate, UITextFieldDelegate>
+
+@property (strong, nonatomic) IBOutlet UITextField *nameField;
+@property (strong, nonatomic) IBOutlet UITextField *serialNumberField;
+@property (strong, nonatomic) IBOutlet UITextField *valueField;
+@property (strong, nonatomic) IBOutlet UILabel *dataField;
+@property (strong, nonatomic) Possession *possession;
+
+@end
View
65 Homepwner/Homepwner/ItemDetailViewController.m
@@ -0,0 +1,65 @@
+//
+// ItemDetailViewController.m
+// Homepwner
+//
+// Created by 栗林健太郎 on 3/13/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "ItemDetailViewController.h"
+
+@implementation ItemDetailViewController
+@synthesize nameField;
+@synthesize serialNumberField;
+@synthesize valueField;
+@synthesize dataField;
+@synthesize possession;
+
+- (void) viewDidLoad
+{
+ [super viewDidLoad];
+ [[self view] setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+
+ [nameField setText:[possession possessionName]];
+ [serialNumberField setText:[possession serialNumber]];
+ [valueField setText:[NSString stringWithFormat:@"%d", [possession valueInDollars]]];
+
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
+ [dateFormatter setTimeStyle:NSDateFormatterNoStyle];
+
+ [dataField setText:[dateFormatter stringFromDate:[possession dateCreated]]];
+ [[self navigationItem] setTitle:[possession possessionName]];
+}
+
+- (void)viewWillDisappear:(BOOL)animated
+{
+ [super viewWillDisappear:animated];
+ [[self view] endEditing:YES];
+
+ [possession setPossessionName:[nameField text]];
+ [possession setSerialNumber:[serialNumberField text]];
+ [possession setValueInDollars:[[valueField text] intValue]];
+}
+
+- (void)viewDidUnload {
+ [self setNameField:nil];
+ [self setSerialNumberField:nil];
+ [self setValueField:nil];
+ [self setDataField:nil];
+ [self setPossession:nil];
+ [super viewDidUnload];
+}
+
+- (BOOL)textFieldShouldReturn:(UITextField *)textField
+{
+ [textField resignFirstResponder];
+ return YES;
+}
+
+@end
View
394 Homepwner/Homepwner/ItemDetailViewController.xib
@@ -0,0 +1,394 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1280</int>
+ <string key="IBDocument.SystemVersion">11D50b</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.AppKitVersion">1138.32</string>
+ <string key="IBDocument.HIToolboxVersion">568.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">933</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBUITextField</string>
+ <string>IBUIView</string>
+ <string>IBUILabel</string>
+ <string>IBProxyObject</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUILabel" id="4447233">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 29}, {46, 21}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSNextKeyView" ref="953945221"/>
+ <string key="NSReuseIdentifierKey">_NS:328</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <int key="IBUIContentMode">7</int>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Name</string>
+ <object class="NSColor" key="IBUITextColor" id="803752448">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <object class="IBUIFontDescription" key="IBUIFontDescription" id="489582456">
+ <int key="type">1</int>
+ <double key="pointSize">17</double>
+ </object>
+ <object class="NSFont" key="IBUIFont" id="12942665">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">17</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ </object>
+ <object class="IBUILabel" id="845512802">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 72}, {44, 21}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSNextKeyView" ref="507333061"/>
+ <string key="NSReuseIdentifierKey">_NS:328</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <int key="IBUIContentMode">7</int>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Serial</string>
+ <reference key="IBUITextColor" ref="803752448"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <reference key="IBUIFontDescription" ref="489582456"/>
+ <reference key="IBUIFont" ref="12942665"/>
+ </object>
+ <object class="IBUILabel" id="223716052">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 120}, {44, 21}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSNextKeyView" ref="157647224"/>
+ <string key="NSReuseIdentifierKey">_NS:328</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <int key="IBUIContentMode">7</int>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Value</string>
+ <reference key="IBUITextColor" ref="803752448"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <reference key="IBUIFontDescription" ref="489582456"/>
+ <reference key="IBUIFont" ref="12942665"/>
+ </object>
+ <object class="IBUILabel" id="131392202">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{113, 166}, {42, 21}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSNextKeyView"/>
+ <string key="NSReuseIdentifierKey">_NS:328</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <int key="IBUIContentMode">7</int>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Label</string>
+ <reference key="IBUITextColor" ref="803752448"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <reference key="IBUIFontDescription" ref="489582456"/>
+ <reference key="IBUIFont" ref="12942665"/>
+ </object>
+ <object class="IBUITextField" id="953945221">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{86, 24}, {190, 31}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSNextKeyView" ref="845512802"/>
+ <string key="NSReuseIdentifierKey">_NS:304</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <string key="IBUIText"/>
+ <int key="IBUIBorderStyle">3</int>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace" id="590571972">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <bool key="IBUIAdjustsFontSizeToFit">YES</bool>
+ <float key="IBUIMinimumFontSize">17</float>
+ <object class="IBUITextInputTraits" key="IBUITextInputTraits">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription" id="991855833">
+ <int key="type">1</int>
+ <double key="pointSize">14</double>
+ </object>
+ <object class="NSFont" key="IBUIFont" id="952517885">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">14</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ </object>
+ <object class="IBUITextField" id="507333061">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{86, 67}, {97, 31}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSNextKeyView" ref="223716052"/>
+ <string key="NSReuseIdentifierKey">_NS:304</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <string key="IBUIText"/>
+ <int key="IBUIBorderStyle">3</int>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ <reference key="NSCustomColorSpace" ref="590571972"/>
+ </object>
+ <bool key="IBUIAdjustsFontSizeToFit">YES</bool>
+ <float key="IBUIMinimumFontSize">17</float>
+ <object class="IBUITextInputTraits" key="IBUITextInputTraits">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <reference key="IBUIFontDescription" ref="991855833"/>
+ <reference key="IBUIFont" ref="952517885"/>
+ </object>
+ <object class="IBUITextField" id="157647224">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{86, 115}, {97, 31}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSNextKeyView" ref="131392202"/>
+ <string key="NSReuseIdentifierKey">_NS:304</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <string key="IBUIText"/>
+ <int key="IBUIBorderStyle">3</int>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ <reference key="NSCustomColorSpace" ref="590571972"/>
+ </object>
+ <bool key="IBUIAdjustsFontSizeToFit">YES</bool>
+ <float key="IBUIMinimumFontSize">17</float>
+ <object class="IBUITextInputTraits" key="IBUITextInputTraits">
+ <int key="IBUIKeyboardType">4</int>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <reference key="IBUIFontDescription" ref="991855833"/>
+ <reference key="IBUIFont" ref="952517885"/>
+ </object>
+ </array>
+ <string key="NSFrame">{{0, 20}, {320, 460}}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSNextKeyView" ref="4447233"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ <reference key="NSCustomColorSpace" ref="590571972"/>
+ </object>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </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">nameField</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="953945221"/>
+ </object>
+ <int key="connectionID">11</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">serialNumberField</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="507333061"/>
+ </object>
+ <int key="connectionID">12</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">valueField</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="157647224"/>
+ </object>
+ <int key="connectionID">13</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">dataField</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="131392202"/>
+ </object>
+ <int key="connectionID">14</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="953945221"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">15</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="507333061"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">16</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="157647224"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="953945221"/>
+ <reference ref="507333061"/>
+ <reference ref="157647224"/>
+ <reference ref="4447233"/>
+ <reference ref="845512802"/>
+ <reference ref="223716052"/>
+ <reference ref="131392202"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">4</int>
+ <reference key="object" ref="4447233"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="845512802"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="223716052"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">7</int>
+ <reference key="object" ref="131392202"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">8</int>
+ <reference key="object" ref="953945221"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="507333061"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">10</int>
+ <reference key="object" ref="157647224"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">ItemDetailViewController</string>
+ <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.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">17</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">933</string>
+ </data>
+</archive>
View
5 Homepwner/Homepwner/ItemsViewController.h
@@ -7,13 +7,10 @@
//
#import <Foundation/Foundation.h>
+#import "ItemDetailViewController.h"
@interface ItemsViewController : UITableViewController
-{
- IBOutlet UIView *headerView;
-}
-- (UIView *)headerView;
- (IBAction)addNewPossession:(id)sender;
- (IBAction)toggleEditingMode:(id)sender;
View
48 Homepwner/Homepwner/ItemsViewController.m
@@ -15,6 +15,17 @@ @implementation ItemsViewController
- (id)init
{
self = [super initWithStyle:UITableViewStyleGrouped];
+
+ if (self) {
+ UIBarButtonItem *bbi = [[UIBarButtonItem alloc]
+ initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
+ target:self
+ action:@selector(addNewPossession:)];
+ [[self navigationItem] setRightBarButtonItem:bbi];
+ [[self navigationItem] setTitle:@"Homepwner"];
+ [[self navigationItem] setLeftBarButtonItem:[self editButtonItem]];
+ }
+
return self;
}
@@ -23,6 +34,12 @@ - (id)initWithStyle:(UITableViewStyle)style
return [self init];
}
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+ [[self tableView] reloadData];
+}
+
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
@@ -70,27 +87,6 @@ - (void)tableView:(UITableView *)tableView
toIndex:[destinationIndexPath row]];
}
-- (UIView *)headerView
-{
- if (!headerView) {
- [[NSBundle mainBundle] loadNibNamed:@"HeaderView"
- owner:self
- options:nil];
- }
-
- return headerView;
-}
-
-- (UIView *)tableView:(UITableView *)tableView
-viewForHeaderInSection:(NSInteger)section {
- return [self headerView];
-}
-
-- (CGFloat)tableView:(UITableView *)tableView
-heightForHeaderInSection:(NSInteger)section
-{
- return [[self headerView] bounds].size.height;
-}
- (IBAction)toggleEditingMode:(id)sender
{
@@ -110,4 +106,14 @@ - (IBAction)addNewPossession:(id)sender
[[self tableView] reloadData];
}
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ ItemDetailViewController *detailViewController = [[ItemDetailViewController alloc] init];
+
+ NSArray *possesions = [[PossessionStore defaultStore] allPossessions];
+ [detailViewController setPossession:[possesions objectAtIndex:[indexPath row]]];
+
+ [[self navigationController] pushViewController:detailViewController animated:YES];
+}
+
@end
View
2  Homepwner/Homepwner/en.lproj/MainStoryboard.storyboard
@@ -16,7 +16,7 @@
</view>
</viewController>
</objects>
- <point key="canvasLocation" x="124" y="156"/>
+ <point key="canvasLocation" x="118" y="149"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
Please sign in to comment.
Something went wrong with that request. Please try again.