Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfbfdd57

Browse files
author
Jim Puls
committed
Merge pull request#2 from ios/puls/test-app
Test app and other recruiting trip changes
2 parentsda99ffa +999a464 commitfbfdd57

File tree

141 files changed

+2310
-256
lines changed

Some content is hidden

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

141 files changed

+2310
-256
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
xcuserdata
22
.DS_Store
3+
*.xccheckout
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<documenttype="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"version="3.0"toolsVersion="4514"systemVersion="13B42"targetRuntime="iOS.CocoaTouch"propertyAccessControl="none"useAutolayout="YES"initialViewController="INF-sx-8CY">
3+
<dependencies>
4+
<plugInidentifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin"version="3747"/>
5+
</dependencies>
6+
<scenes>
7+
<!--Master View Controller-->
8+
<scenesceneID="3xf-CV-b2Z">
9+
<objects>
10+
<collectionViewControllerstoryboardIdentifier="Master View Controller"autoresizesArchivedViewToFullSize="NO"id="UH6-2k-Soh"customClass="CGTAMasterViewController"sceneMemberID="viewController">
11+
<collectionViewkey="view"opaque="NO"clipsSubviews="YES"multipleTouchEnabled="YES"contentMode="scaleToFill"minimumZoomScale="0.0"maximumZoomScale="0.0"dataMode="prototypes"id="Ckj-MB-u4F">
12+
<rectkey="frame"x="0.0"y="0.0"width="320"height="568"/>
13+
<autoresizingMaskkey="autoresizingMask"widthSizable="YES"heightSizable="YES"/>
14+
<collectionViewFlowLayoutkey="collectionViewLayout"minimumLineSpacing="0.0"minimumInteritemSpacing="0.0"id="A42-Go-8PB">
15+
<sizekey="itemSize"width="160"height="160"/>
16+
<sizekey="headerReferenceSize"width="0.0"height="0.0"/>
17+
<sizekey="footerReferenceSize"width="0.0"height="0.0"/>
18+
<insetkey="sectionInset"minX="0.0"minY="0.0"maxX="0.0"maxY="0.0"/>
19+
</collectionViewFlowLayout>
20+
<cells>
21+
<collectionViewCellopaque="NO"clipsSubviews="YES"multipleTouchEnabled="YES"contentMode="center"reuseIdentifier="Image Cell"id="mZg-o6-U32"customClass="CGTAFlagCollectionViewCell">
22+
<rectkey="frame"x="0.0"y="64"width="160"height="160"/>
23+
<autoresizingMaskkey="autoresizingMask"/>
24+
<viewkey="contentView"opaque="NO"clipsSubviews="YES"multipleTouchEnabled="YES"contentMode="center">
25+
<rectkey="frame"x="0.0"y="0.0"width="160"height="160"/>
26+
<autoresizingMaskkey="autoresizingMask"/>
27+
<subviews>
28+
<imageViewclipsSubviews="YES"userInteractionEnabled="NO"contentMode="scaleAspectFit"horizontalHuggingPriority="251"verticalHuggingPriority="251"image="USA"translatesAutoresizingMaskIntoConstraints="NO"id="LPM-aq-eVP">
29+
<rectkey="frame"x="0.0"y="0.0"width="160"height="160"/>
30+
<autoresizingMaskkey="autoresizingMask"widthSizable="YES"heightSizable="YES"/>
31+
</imageView>
32+
</subviews>
33+
<colorkey="backgroundColor"white="0.0"alpha="0.0"colorSpace="calibratedWhite"/>
34+
</view>
35+
<constraints>
36+
<constraintfirstAttribute="bottom"secondItem="LPM-aq-eVP"secondAttribute="bottom"id="3dC-zy-EKj"/>
37+
<constraintfirstItem="LPM-aq-eVP"firstAttribute="leading"secondItem="mZg-o6-U32"secondAttribute="leading"id="CUC-Zi-AO2"/>
38+
<constraintfirstAttribute="trailing"secondItem="LPM-aq-eVP"secondAttribute="trailing"id="eON-IQ-OZe"/>
39+
<constraintfirstItem="LPM-aq-eVP"firstAttribute="top"secondItem="mZg-o6-U32"secondAttribute="top"id="rr5-Ix-vFh"/>
40+
</constraints>
41+
<connections>
42+
<outletproperty="imageView"destination="LPM-aq-eVP"id="4Wu-rt-zSB"/>
43+
<seguedestination="Ah7-4n-0Wa"kind="push"identifier="Tap on Flag"id="e5Y-SN-UWY"/>
44+
</connections>
45+
</collectionViewCell>
46+
</cells>
47+
<connections>
48+
<outletproperty="dataSource"destination="UH6-2k-Soh"id="m1v-tP-KJh"/>
49+
<outletproperty="delegate"destination="UH6-2k-Soh"id="b0C-Mp-1P8"/>
50+
</connections>
51+
</collectionView>
52+
<navigationItemkey="navigationItem"id="teh-qR-8dZ">
53+
<nilkey="title"/>
54+
<sliderkey="titleView"opaque="NO"contentMode="scaleToFill"contentHorizontalAlignment="center"contentVerticalAlignment="center"value="120"minValue="0.0"maxValue="160"id="sg9-qZ-59e">
55+
<rectkey="frame"x="8"y="8"width="304"height="29"/>
56+
<autoresizingMaskkey="autoresizingMask"flexibleMaxX="YES"flexibleMaxY="YES"/>
57+
<colorkey="minimumTrackTintColor"red="0.0"green="0.74117648601531982"blue="0.64313727617263794"alpha="1"colorSpace="deviceRGB"/>
58+
<connections>
59+
<actionselector="sliderValueChanged:"destination="UH6-2k-Soh"eventType="valueChanged"id="Tfs-NO-5oy"/>
60+
</connections>
61+
</slider>
62+
</navigationItem>
63+
<connections>
64+
<outletproperty="cellSizeSlider"destination="sg9-qZ-59e"id="gwU-KP-c6P"/>
65+
</connections>
66+
</collectionViewController>
67+
<placeholderplaceholderIdentifier="IBFirstResponder"id="eQs-he-B5Z"userLabel="First Responder"sceneMemberID="firstResponder"/>
68+
</objects>
69+
<pointkey="canvasLocation"x="881"y="64"/>
70+
</scene>
71+
<!--Detail View Controller - Detail-->
72+
<scenesceneID="Cn3-H9-jdl">
73+
<objects>
74+
<viewControllertitle="Detail"id="Ah7-4n-0Wa"customClass="CGTADetailViewController"sceneMemberID="viewController">
75+
<layoutGuides>
76+
<viewControllerLayoutGuidetype="top"id="EK1-eN-tCq"/>
77+
<viewControllerLayoutGuidetype="bottom"id="wQM-DP-Tgk"/>
78+
</layoutGuides>
79+
<viewkey="view"contentMode="scaleToFill"id="MMQ-IT-qOo">
80+
<rectkey="frame"x="0.0"y="0.0"width="320"height="568"/>
81+
<autoresizingMaskkey="autoresizingMask"flexibleMaxX="YES"flexibleMaxY="YES"/>
82+
<subviews>
83+
<imageViewuserInteractionEnabled="NO"contentMode="scaleAspectFit"horizontalHuggingPriority="251"verticalHuggingPriority="251"fixedFrame="YES"translatesAutoresizingMaskIntoConstraints="NO"id="cK7-Bz-0X1">
84+
<rectkey="frame"x="0.0"y="1"width="320"height="568"/>
85+
<autoresizingMaskkey="autoresizingMask"widthSizable="YES"heightSizable="YES"/>
86+
</imageView>
87+
</subviews>
88+
</view>
89+
<navigationItemkey="navigationItem"title="Detail"id="cra-N8-TIN"/>
90+
<connections>
91+
<outletproperty="imageView"destination="cK7-Bz-0X1"id="dbA-f5-cQY"/>
92+
</connections>
93+
</viewController>
94+
<placeholderplaceholderIdentifier="IBFirstResponder"id="lrm-kH-fPn"sceneMemberID="firstResponder"/>
95+
</objects>
96+
<pointkey="canvasLocation"x="1428"y="64"/>
97+
</scene>
98+
<!--Navigation Controller-->
99+
<scenesceneID="Gwc-n1-nXR">
100+
<objects>
101+
<navigationControllerautomaticallyAdjustsScrollViewInsets="NO"id="INF-sx-8CY"sceneMemberID="viewController">
102+
<toolbarItems/>
103+
<navigationBarkey="navigationBar"contentMode="scaleToFill"id="rje-BN-VLD">
104+
<rectkey="frame"x="0.0"y="0.0"width="320"height="44"/>
105+
<autoresizingMaskkey="autoresizingMask"/>
106+
<colorkey="tintColor"red="0.0"green="0.74117648601531982"blue="0.64313727617263794"alpha="1"colorSpace="deviceRGB"/>
107+
<textAttributeskey="titleTextAttributes">
108+
<colorkey="textColor"red="0.0"green="0.74117648601531982"blue="0.64313727617263794"alpha="1"colorSpace="deviceRGB"/>
109+
</textAttributes>
110+
</navigationBar>
111+
<nilname="viewControllers"/>
112+
<connections>
113+
<seguedestination="UH6-2k-Soh"kind="relationship"relationship="rootViewController"id="2pt-sd-z5Z"/>
114+
</connections>
115+
</navigationController>
116+
<placeholderplaceholderIdentifier="IBFirstResponder"id="dXu-Dv-wXY"userLabel="First Responder"sceneMemberID="firstResponder"/>
117+
</objects>
118+
<pointkey="canvasLocation"x="478"y="64"/>
119+
</scene>
120+
</scenes>
121+
<resources>
122+
<imagename="USA"width="128"height="128"/>
123+
</resources>
124+
<simulatedMetricsContainerkey="defaultSimulatedMetrics">
125+
<simulatedStatusBarMetricskey="statusBar"/>
126+
<simulatedOrientationMetricskey="orientation"/>
127+
<simulatedScreenMetricskey="destination"type="retina4"/>
128+
</simulatedMetricsContainer>
129+
</document>

‎CodeGenTestApp/CGTAAppDelegate.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// CGTAAppDelegate.h
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Licensed to Square, Inc. under one or more contributor license agreements.
7+
// See the LICENSE file distributed with this work for the terms under
8+
// which Square, Inc. licenses this file to you.
9+
10+
11+
@interfaceCGTAAppDelegate :UIResponder <UIApplicationDelegate>
12+
13+
@property (strong,nonatomic) UIWindow *window;
14+
15+
@end

‎CodeGenTestApp/CGTAAppDelegate.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// CGTAAppDelegate.m
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Licensed to Square, Inc. under one or more contributor license agreements.
7+
// See the LICENSE file distributed with this work for the terms under
8+
// which Square, Inc. licenses this file to you.
9+
10+
#import"CGTAAppDelegate.h"
11+
12+
@implementationCGTAAppDelegate
13+
@end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// CGTADetailViewController.h
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Licensed to Square, Inc. under one or more contributor license agreements.
7+
// See the LICENSE file distributed with this work for the terms under
8+
// which Square, Inc. licenses this file to you.
9+
10+
11+
@interfaceCGTADetailViewController :UIViewController
12+
13+
@property (nonatomic,strong) UIImage *image;
14+
15+
@end
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// CGTADetailViewController.m
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Licensed to Square, Inc. under one or more contributor license agreements.
7+
// See the LICENSE file distributed with this work for the terms under
8+
// which Square, Inc. licenses this file to you.
9+
10+
#import"CGTADetailViewController.h"
11+
#import"CGTATestAppColorList.h"
12+
13+
14+
@interfaceCGTADetailViewController ()
15+
16+
@property (nonatomic,strong)IBOutlet UIImageView *imageView;
17+
18+
@end
19+
20+
21+
@implementationCGTADetailViewController
22+
23+
- (void)setImage:(UIImage *)image;
24+
{
25+
_image = image;
26+
[selfupdateView];
27+
}
28+
29+
- (void)viewDidLoad;
30+
{
31+
[selfupdateView];
32+
33+
CAGradientLayer *layer = [CAGradientLayerlayer];
34+
layer.startPoint =CGPointMake(0.5,0.5);
35+
layer.endPoint =CGPointMake(0.5,1.0);
36+
37+
layer.colors = @[(id)[UIColorwhiteColor].CGColor, (id)[CGTATestAppColorListtealColor].CGColor];
38+
layer.frame = self.view.layer.bounds;
39+
[self.view.layerinsertSublayer:layeratIndex:0];
40+
}
41+
42+
- (void)updateView;
43+
{
44+
self.imageView.image = self.image;
45+
}
46+
47+
@end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// CGTAImagesCatalog+RuntimeHackery.h
3+
// codegenutils
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Licensed to Square, Inc. under one or more contributor license agreements.
7+
// See the LICENSE file distributed with this work for the terms under
8+
// which Square, Inc. licenses this file to you.
9+
10+
#import"CGTAImagesCatalog.h"
11+
12+
@interfaceCGTAImagesCatalog (RuntimeHackery)
13+
14+
+ (NSArray *)allImages;
15+
16+
@end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// CGTAImagesCatalog+RuntimeHackery.m
3+
// codegenutils
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Licensed to Square, Inc. under one or more contributor license agreements.
7+
// See the LICENSE file distributed with this work for the terms under
8+
// which Square, Inc. licenses this file to you.
9+
10+
#import"CGTAImagesCatalog+RuntimeHackery.h"
11+
12+
#import<objc/runtime.h>
13+
#import<objc/message.h>
14+
15+
16+
@implementationCGTAImagesCatalog (RuntimeHackery)
17+
18+
+ (NSArray *)allImages;
19+
{
20+
NSMutableArray *images = [NSMutableArrayarray];
21+
unsignedint count;
22+
Method *methods =class_copyMethodList(object_getClass(self), &count);
23+
for (unsignedint index =0; index < count; index++) {
24+
if (sel_isEqual(method_getName(methods[index]), _cmd)) {
25+
continue;
26+
}
27+
id image =method_invoke(self, methods[index]);
28+
[imagesaddObject:image];
29+
}
30+
free(methods);
31+
return images;
32+
}
33+
34+
@end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// CGTAMasterViewController.h
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Licensed to Square, Inc. under one or more contributor license agreements.
7+
// See the LICENSE file distributed with this work for the terms under
8+
// which Square, Inc. licenses this file to you.
9+
10+
11+
@interfaceCGTAMasterViewController :UICollectionViewController
12+
@end
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
//
2+
// CGTAMasterViewController.m
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Licensed to Square, Inc. under one or more contributor license agreements.
7+
// See the LICENSE file distributed with this work for the terms under
8+
// which Square, Inc. licenses this file to you.
9+
10+
#import"CGTAMasterViewController.h"
11+
#import"CGTADetailViewController.h"
12+
#import"CGTAImagesCatalog+RuntimeHackery.h"
13+
#import"CGTAMainStoryboardIdentifiers.h"
14+
15+
16+
@interfaceCGTAFlagCollectionViewCell :UICollectionViewCell
17+
18+
@property (nonatomic,weak)IBOutlet UIImageView *imageView;
19+
20+
@end
21+
22+
23+
@interfaceCGTAMasterViewController ()
24+
25+
@property (nonatomic,weak)IBOutlet UISlider *cellSizeSlider;
26+
@property (nonatomic,strong)NSArray *flagImages;
27+
28+
@end
29+
30+
31+
@implementationCGTAMasterViewController
32+
33+
#pragma mark - NSObject
34+
35+
- (void)awakeFromNib;
36+
{
37+
[selfsliderValueChanged:self.cellSizeSlider];
38+
}
39+
40+
#pragma mark - UIViewController
41+
42+
- (void)prepareForSegue:(UIStoryboardSegue *)seguesender:(id)sender;
43+
{
44+
if ([segue.identifierisEqualToString:CGTAMainStoryboardTapOnFlagIdentifier]) {
45+
CGTADetailViewController *detailViewController = segue.destinationViewController;
46+
detailViewController.image = ((CGTAFlagCollectionViewCell *)sender).imageView.image;
47+
}
48+
}
49+
50+
#pragma mark - Private methods
51+
52+
- (IBAction)sliderValueChanged:(UISlider *)sender;
53+
{
54+
float newValue = sender.value;
55+
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout;
56+
layout.itemSize =CGSizeMake(newValue, newValue);
57+
}
58+
59+
- (NSArray *)flagImages;
60+
{
61+
NSArray *allFlagImages =nil;
62+
63+
// Initial version: full of strings that you have to type correctly!
64+
// Misspell any of these and your app will crash on trying to add `nil` to an array.
65+
allFlagImages = @[[UIImageimageNamed:@"USA"], [UIImageimageNamed:@"Canada"], [UIImageimageNamed:@"UK"], [UIImageimageNamed:@"Australia"]];
66+
67+
// New version: get the properly compiler-checked spelling from the image catalog.
68+
allFlagImages = @[[CGTAImagesCatalogusaImage], [CGTAImagesCatalogcanadaImage], [CGTAImagesCatalogukImage], [CGTAImagesCatalogaustraliaImage]];
69+
70+
// But really, why not use a little runtime hackery because we can?
71+
return [CGTAImagesCatalogallImages];
72+
}
73+
74+
#pragma mark - UICollectionViewDataSource
75+
76+
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView;
77+
{
78+
return1;
79+
}
80+
81+
- (NSInteger)collectionView:(UICollectionView *)collectionViewnumberOfItemsInSection:(NSInteger)section;
82+
{
83+
return self.flagImages.count;
84+
}
85+
86+
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionViewcellForItemAtIndexPath:(NSIndexPath *)indexPath;
87+
{
88+
CGTAFlagCollectionViewCell *cell = (CGTAFlagCollectionViewCell *)[collectionViewdequeueReusableCellWithReuseIdentifier:CGTAMainStoryboardImageCellIdentifierforIndexPath:indexPath];
89+
cell.imageView.image = self.flagImages[indexPath.item];
90+
return cell;
91+
}
92+
93+
@end
94+
95+
96+
@implementationCGTAFlagCollectionViewCell
97+
@end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp