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

Commit85c48fc

Browse files
author
Jim Puls
committed
Test app
1 parentda99ffa commit85c48fc

File tree

128 files changed

+2069
-58
lines changed

Some content is hidden

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

128 files changed

+2069
-58
lines changed
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+
// Copyright (c) 2014 Square, Inc. All rights reserved.
7+
//
8+
9+
#import<UIKit/UIKit.h>
10+
11+
@interfaceCGTAAppDelegate :UIResponder <UIApplicationDelegate>
12+
13+
@property (strong,nonatomic) UIWindow *window;
14+
15+
@end

‎CodeGenTestApp/CGTAAppDelegate.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// CGTAAppDelegate.m
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Copyright (c) 2014 Square, Inc. All rights reserved.
7+
//
8+
9+
#import"CGTAAppDelegate.h"
10+
11+
@implementationCGTAAppDelegate
12+
@end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// CGTADetailViewController.h
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Copyright (c) 2014 Square, Inc. All rights reserved.
7+
//
8+
9+
#import<UIKit/UIKit.h>
10+
11+
12+
@interfaceCGTADetailViewController :UIViewController
13+
14+
@property (nonatomic,strong) UIImage *image;
15+
16+
@end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// CGTADetailViewController.m
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Copyright (c) 2014 Square, Inc. All rights reserved.
7+
//
8+
9+
#import"CGTADetailViewController.h"
10+
#import"CGTATestAppColorList.h"
11+
12+
13+
@interfaceCGTADetailViewController ()
14+
15+
@property (nonatomic,strong)IBOutlet UIImageView *imageView;
16+
17+
@end
18+
19+
20+
@implementationCGTADetailViewController
21+
22+
- (void)setImage:(UIImage *)image;
23+
{
24+
_image = image;
25+
[selfupdateView];
26+
}
27+
28+
- (void)viewDidLoad;
29+
{
30+
[selfupdateView];
31+
32+
CAGradientLayer *layer = [CAGradientLayerlayer];
33+
layer.startPoint =CGPointMake(0.5,0.5);
34+
layer.endPoint =CGPointMake(0.5,1.0);
35+
36+
layer.colors = @[(id)[UIColorwhiteColor].CGColor, (id)[CGTATestAppColorListtealColor].CGColor];
37+
layer.frame = self.view.layer.bounds;
38+
[self.view.layerinsertSublayer:layeratIndex:0];
39+
}
40+
41+
- (void)updateView;
42+
{
43+
self.imageView.image = self.image;
44+
}
45+
46+
@end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// CGTAImagesCatalog+RuntimeHackery.h
3+
// codegenutils
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Copyright (c) 2014 Square, Inc. All rights reserved.
7+
//
8+
9+
#import"CGTAImagesCatalog.h"
10+
11+
@interfaceCGTAImagesCatalog (RuntimeHackery)
12+
13+
+ (NSArray *)allImages;
14+
15+
@end
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// CGTAImagesCatalog+RuntimeHackery.m
3+
// codegenutils
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Copyright (c) 2014 Square, Inc. All rights reserved.
7+
//
8+
9+
#import"CGTAImagesCatalog+RuntimeHackery.h"
10+
11+
#import<objc/runtime.h>
12+
#import<objc/message.h>
13+
14+
15+
@implementationCGTAImagesCatalog (RuntimeHackery)
16+
17+
+ (NSArray *)allImages;
18+
{
19+
NSMutableArray *images = [NSMutableArrayarray];
20+
unsignedint count;
21+
Method *methods =class_copyMethodList(object_getClass(self), &count);
22+
for (unsignedint index =0; index < count; index++) {
23+
if (sel_isEqual(method_getName(methods[index]), _cmd)) {
24+
continue;
25+
}
26+
id image =method_invoke(self, methods[index]);
27+
[imagesaddObject:image];
28+
}
29+
free(methods);
30+
return images;
31+
}
32+
33+
@end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// CGTAMasterViewController.h
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Copyright (c) 2014 Square, Inc. All rights reserved.
7+
//
8+
9+
#import<UIKit/UIKit.h>
10+
11+
12+
@interfaceCGTAMasterViewController :UICollectionViewController
13+
@end
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
//
2+
// CGTAMasterViewController.m
3+
// CodeGenTestApp
4+
//
5+
// Created by Jim Puls on 2/3/14.
6+
// Copyright (c) 2014 Square, Inc. All rights reserved.
7+
//
8+
9+
#import"CGTAMasterViewController.h"
10+
#import"CGTADetailViewController.h"
11+
#import"CGTAImagesCatalog+RuntimeHackery.h"
12+
#import"CGTAMainStoryboardIdentifiers.h"
13+
14+
@interfaceCGTAFlagCollectionViewCell :UICollectionViewCell
15+
16+
@property (nonatomic,weak)IBOutlet UIImageView *imageView;
17+
18+
@end
19+
20+
21+
@interfaceCGTAMasterViewController ()
22+
23+
@property (nonatomic,weak)IBOutlet UISlider *cellSizeSlider;
24+
@property (nonatomic,strong)NSArray *flagImages;
25+
26+
@end
27+
28+
29+
@implementationCGTAMasterViewController
30+
31+
#pragma mark - NSObject
32+
33+
- (void)awakeFromNib;
34+
{
35+
[selfsliderValueChanged:self.cellSizeSlider];
36+
}
37+
38+
#pragma mark - UIViewController
39+
40+
- (void)prepareForSegue:(UIStoryboardSegue *)seguesender:(id)sender;
41+
{
42+
if ([segue.identifierisEqualToString:CGTAMainStoryboardTapOnFlagIdentifier]) {
43+
CGTADetailViewController *detailViewController = segue.destinationViewController;
44+
detailViewController.image = ((CGTAFlagCollectionViewCell *)sender).imageView.image;
45+
}
46+
}
47+
48+
#pragma mark - Private methods
49+
50+
- (IBAction)sliderValueChanged:(UISlider *)sender;
51+
{
52+
float newValue = sender.value;
53+
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout;
54+
layout.itemSize =CGSizeMake(newValue, newValue);
55+
}
56+
57+
- (NSArray *)flagImages;
58+
{
59+
// return @[[UIImage imageNamed:@"USA"], [UIImage imageNamed:@"Canada"], [UIImage imageNamed:@"UK"], [UIImage imageNamed:@"Austrlia"]];
60+
// return @[[CGTAImagesCatalog usaImage], [CGTAImagesCatalog canadaImage], [CGTAImagesCatalog ukImage], [CGTAImagesCatalog australiaImage]];
61+
return [CGTAImagesCatalogallImages];
62+
}
63+
64+
#pragma mark - UICollectionViewDataSource
65+
66+
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView;
67+
{
68+
return1;
69+
}
70+
71+
- (NSInteger)collectionView:(UICollectionView *)collectionViewnumberOfItemsInSection:(NSInteger)section;
72+
{
73+
return self.flagImages.count;
74+
}
75+
76+
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionViewcellForItemAtIndexPath:(NSIndexPath *)indexPath;
77+
{
78+
CGTAFlagCollectionViewCell *cell = (CGTAFlagCollectionViewCell *)[collectionViewdequeueReusableCellWithReuseIdentifier:CGTAMainStoryboardImageCellIdentifierforIndexPath:indexPath];
79+
cell.imageView.image = self.flagImages[indexPath.item];
80+
return cell;
81+
}
82+
83+
@end
84+
85+
86+
@implementationCGTAFlagCollectionViewCell
87+
@end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp