Skip to content

Commit 973383b

Browse files
committed
final chapter 36 examples
1 parent 8cd01c9 commit 973383b

File tree

77 files changed

+7878
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+7878
-0
lines changed

ch36p1070xml/ch36p1070xml.xcodeproj/project.pbxproj

Lines changed: 348 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
#import <UIKit/UIKit.h>
4+
5+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
6+
7+
@property (strong, nonatomic) UIWindow *window;
8+
9+
@end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
3+
#import "AppDelegate.h"
4+
5+
@implementation AppDelegate
6+
7+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8+
{
9+
// Override point for customization after application launch.
10+
return YES;
11+
}
12+
13+
14+
@end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
5+
</dependencies>
6+
<scenes>
7+
<!--View Controller-->
8+
<scene sceneID="ufC-wZ-h7g">
9+
<objects>
10+
<viewController id="vXZ-lx-hvc" customClass="ViewController" sceneMemberID="viewController">
11+
<layoutGuides>
12+
<viewControllerLayoutGuide type="top" id="6zw-FJ-fgz"/>
13+
<viewControllerLayoutGuide type="bottom" id="MtT-H1-4BH"/>
14+
</layoutGuides>
15+
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
16+
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
17+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
18+
<subviews>
19+
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8sa-67-jFu">
20+
<rect key="frame" x="20" y="20" width="119" height="30"/>
21+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
22+
<state key="normal" title="Parse Some XML">
23+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
24+
</state>
25+
<connections>
26+
<action selector="doButton:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="3nr-ZZ-GKn"/>
27+
</connections>
28+
</button>
29+
</subviews>
30+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
31+
</view>
32+
</viewController>
33+
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
34+
</objects>
35+
</scene>
36+
</scenes>
37+
<simulatedMetricsContainer key="defaultSimulatedMetrics">
38+
<simulatedStatusBarMetrics key="statusBar"/>
39+
<simulatedOrientationMetrics key="orientation"/>
40+
<simulatedScreenMetrics key="destination" type="retina4"/>
41+
</simulatedMetricsContainer>
42+
</document>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "29x29",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "40x40",
11+
"scale" : "2x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "60x60",
16+
"scale" : "2x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"orientation" : "portrait",
5+
"idiom" : "iphone",
6+
"extent" : "full-screen",
7+
"minimum-system-version" : "7.0",
8+
"scale" : "2x"
9+
},
10+
{
11+
"orientation" : "portrait",
12+
"idiom" : "iphone",
13+
"subtype" : "retina4",
14+
"extent" : "full-screen",
15+
"minimum-system-version" : "7.0",
16+
"scale" : "2x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
#import <Foundation/Foundation.h>
4+
#import "MyXMLParserDelegate.h"
5+
6+
@interface MyPeopleParser : MyXMLParserDelegate
7+
8+
@property (nonatomic, strong) NSMutableArray* people;
9+
10+
@end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
3+
#import "MyPeopleParser.h"
4+
#import "MyPersonParser.h"
5+
6+
@implementation MyPeopleParser
7+
8+
9+
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
10+
{
11+
if ([elementName isEqualToString: @"people"])
12+
self.people = [NSMutableArray array];
13+
if ([elementName isEqualToString: @"person"]) {
14+
[self makeChild:[MyPersonParser class] elementName:elementName parser:parser];
15+
}
16+
}
17+
18+
- (void) finishedChild: (NSString*) s {
19+
[self.people addObject: [(MyPersonParser*)self.child person]];
20+
}
21+
22+
23+
@end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
#import <Foundation/Foundation.h>
4+
#import "MyXMLParserDelegate.h"
5+
@class Person;
6+
7+
@interface MyPersonParser : MyXMLParserDelegate
8+
9+
@property (nonatomic, strong) Person* person;
10+
11+
@end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
3+
#import "MyPersonParser.h"
4+
#import "Person.h"
5+
6+
@implementation MyPersonParser
7+
8+
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict {
9+
[self makeChild:[MyXMLParserDelegate class] elementName:elementName parser:parser];
10+
}
11+
12+
- (void) finishedChild:(NSString *)s {
13+
if (!self.person) {
14+
Person* p = [Person new];
15+
self.person = p;
16+
}
17+
[self.person setValue: s forKey: self.child.name];
18+
}
19+
20+
21+
22+
@end

0 commit comments

Comments
 (0)