Added collectionView demo

Has the problem described in #93
This commit is contained in:
Mazyad Alabduljaleel 2015-10-20 19:41:36 -07:00
parent fb81a41a57
commit ff67d2b0a0
4 changed files with 157 additions and 4 deletions

View File

@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
8262C8551BD730DD00B610A0 /* TLYCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8262C8541BD730DD00B610A0 /* TLYCollectionViewController.m */; settings = {ASSET_TAGS = (); }; };
8268FA02194C926F004EC0E4 /* TLYShyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8268FA01194C926F004EC0E4 /* TLYShyViewController.m */; };
8268FA13194DBA58004EC0E4 /* TLYShyNavBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8268FA12194DBA58004EC0E4 /* TLYShyNavBarManager.m */; };
828F57201949C37B009EB8DD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 828F571F1949C37B009EB8DD /* Foundation.framework */; };
@ -40,6 +41,8 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
8262C8531BD730DD00B610A0 /* TLYCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYCollectionViewController.h; sourceTree = "<group>"; };
8262C8541BD730DD00B610A0 /* TLYCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYCollectionViewController.m; sourceTree = "<group>"; };
8268FA00194C926F004EC0E4 /* TLYShyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyViewController.h; sourceTree = "<group>"; };
8268FA01194C926F004EC0E4 /* TLYShyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyViewController.m; sourceTree = "<group>"; };
8268FA11194DBA58004EC0E4 /* TLYShyNavBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBarManager.h; sourceTree = "<group>"; };
@ -97,6 +100,15 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
8262C8521BD730CB00B610A0 /* CollectionView */ = {
isa = PBXGroup;
children = (
8262C8531BD730DD00B610A0 /* TLYCollectionViewController.h */,
8262C8541BD730DD00B610A0 /* TLYCollectionViewController.m */,
);
name = CollectionView;
sourceTree = "<group>";
};
828F57131949C37B009EB8DD = {
isa = PBXGroup;
children = (
@ -131,6 +143,7 @@
828F57251949C37B009EB8DD /* TLYShyNavBarDemo */ = {
isa = PBXGroup;
children = (
8262C8521BD730CB00B610A0 /* CollectionView */,
828F572E1949C37B009EB8DD /* TLYAppDelegate.h */,
828F572F1949C37B009EB8DD /* TLYAppDelegate.m */,
828F57311949C37B009EB8DD /* Main.storyboard */,
@ -305,6 +318,7 @@
8268FA02194C926F004EC0E4 /* TLYShyViewController.m in Sources */,
829FEE001957DF620017E186 /* NSObject+TLYSwizzlingHelpers.m in Sources */,
828F57361949C37B009EB8DD /* TLYViewController.m in Sources */,
8262C8551BD730DD00B610A0 /* TLYCollectionViewController.m in Sources */,
828F572C1949C37B009EB8DD /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -3,6 +3,7 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--View Controller-->
@ -183,15 +184,15 @@
</subviews>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="6" textLabel="JCj-eZ-ePK" style="IBUITableViewCellStyleDefault" id="lDx-31-RTM">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="6" textLabel="JCj-eZ-ePK" style="IBUITableViewCellStyleDefault" id="lDx-31-RTM">
<rect key="frame" x="0.0" y="350" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="lDx-31-RTM" id="Pch-9t-ngw">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="287" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="TODO: Test UICollectionView" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="JCj-eZ-ePK">
<rect key="frame" x="15" y="0.0" width="290" height="43.5"/>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Test UICollectionView" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="JCj-eZ-ePK">
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
@ -199,6 +200,9 @@
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="4gk-yU-wN3" kind="push" id="POL-mj-jIP"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
@ -283,6 +287,54 @@
</objects>
<point key="canvasLocation" x="783" y="-532"/>
</scene>
<!--Collection View Controller-->
<scene sceneID="PhO-85-s6k">
<objects>
<collectionViewController id="4gk-yU-wN3" customClass="TLYCollectionViewController" sceneMemberID="viewController">
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="Kig-Vq-sPc">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.97254901959999995" green="0.97254901959999995" blue="0.97254901959999995" alpha="1" colorSpace="calibratedRGB"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="vIy-T8-j61">
<size key="itemSize" width="320" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="Cell" id="mxc-A2-oU2">
<rect key="frame" x="0.0" y="64" width="320" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" tag="777" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Vf-lE-VWT">
<rect key="frame" x="8" y="14" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<constraints>
<constraint firstAttribute="leadingMargin" secondItem="0Vf-lE-VWT" secondAttribute="leading" id="hNm-aF-Ss8"/>
<constraint firstItem="0Vf-lE-VWT" firstAttribute="centerY" secondItem="mxc-A2-oU2" secondAttribute="centerY" id="lhQ-IH-0UI"/>
</constraints>
</collectionViewCell>
</cells>
<connections>
<outlet property="dataSource" destination="4gk-yU-wN3" id="22b-GS-Mud"/>
<outlet property="delegate" destination="4gk-yU-wN3" id="e1K-0B-2eC"/>
</connections>
</collectionView>
<navigationItem key="navigationItem" id="TxI-1J-d2i"/>
</collectionViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="rvW-nN-PLP" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-528" y="557"/>
</scene>
<!--View Controller-->
<scene sceneID="WAx-ee-jTN">
<objects>

View File

@ -0,0 +1,13 @@
//
// TLYCollectionViewController.h
// TLYShyNavBarDemo
//
// Created by Mazyad Alabduljaleel on 10/20/15.
// Copyright © 2015 Telly, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TLYCollectionViewController : UICollectionViewController
@end

View File

@ -0,0 +1,74 @@
//
// TLYCollectionViewController.m
// TLYShyNavBarDemo
//
// Created by Mazyad Alabduljaleel on 10/20/15.
// Copyright © 2015 Telly, Inc. All rights reserved.
//
#import "TLYCollectionViewController.h"
@interface TLYCollectionViewController ()
@property (nonatomic, strong) NSArray *data;
@end
@implementation TLYCollectionViewController
static NSString * const reuseIdentifier = @"Cell";
- (void)viewDidLoad {
[super viewDidLoad];
self.data = @[@"No Game No Life",
@"Ookami Kodomo no Ame to Yuki",
@"Owari no Seraph",
@"Prince of Tennis",
@"Psycho-Pass",
@"Psycho-Pass 2",
@"School Rumble",
@"Sen to Chihiro no Kamikakushi",
@"Shijou Saikyou no Deshi Kenichi",
@"Shingeki no Kyojin",
@"Soul Eater",
@"Steins;Gate",
@"Summer Wars",
@"Sword Art Online",
@"Sword Art Online II",
@"Tenkuu no Shiro Laputa",
@"Toki wo Kakeru Shoujo",
@"Tokyo Ghoul",
@"Tonari no Totoro",
@"Uchuu Kyoudai",
@"Yakitate!! Japan",
@"Zankyou ",
];
UIView *view = view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 40.f)];
view.backgroundColor = [UIColor redColor];
/* Library code */
self.shyNavBarManager.scrollView = self.collectionView;
/* Can then be remove by setting the ExtensionView to nil */
[self.shyNavBarManager setExtensionView:view];
}
#pragma mark <UICollectionViewDataSource>
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.data.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
UILabel *label = (id)[cell viewWithTag:777];
label.text = self.data[indexPath.item];
return cell;
}
@end