Permalink
Browse files

Add TableView example

  • Loading branch information...
autresphere committed Jan 28, 2013
1 parent 696e6c4 commit a3e58a3c4ee27ba038d225a818c8b9cbd055c359
@@ -37,5 +37,6 @@
@property (nonatomic, assign) BOOL zoomEnabled;
- (void)installOnViews:(NSArray *)views;
+- (void)installOnView:(UIView *)view;
@end
@@ -12,8 +12,7 @@
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
- <string>IBUIImageView</string>
- <string>IBUIScrollView</string>
+ <string>IBUITableView</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
@@ -36,111 +35,39 @@
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
- <object class="IBUIScrollView" id="734663765">
+ <object class="IBUITableView" id="720695079">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="IBUIView" id="143169037">
- <reference key="NSNextResponder" ref="734663765"/>
- <int key="NSvFlags">292</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="IBUIImageView" id="401923886">
- <reference key="NSNextResponder" ref="143169037"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrame">{{59, 15}, {202, 113}}</string>
- <reference key="NSSuperview" ref="143169037"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="521480597"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <int key="IBUIContentMode">1</int>
- <bool key="IBUIUserInteractionEnabled">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <object class="NSCustomResource" key="IBUIImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">1.jpg</string>
- </object>
- </object>
- <object class="IBUIImageView" id="240106516">
- <reference key="NSNextResponder" ref="143169037"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrame">{{59, 365}, {202, 114}}</string>
- <reference key="NSSuperview" ref="143169037"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="94701967"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <int key="IBUIContentMode">1</int>
- <bool key="IBUIUserInteractionEnabled">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <object class="NSCustomResource" key="IBUIImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">2.jpg</string>
- </object>
- </object>
- <object class="IBUIImageView" id="521480597">
- <reference key="NSNextResponder" ref="143169037"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrame">{{59, 184}, {202, 113}}</string>
- <reference key="NSSuperview" ref="143169037"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="240106516"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <int key="IBUIContentMode">1</int>
- <bool key="IBUIUserInteractionEnabled">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <object class="NSCustomResource" key="IBUIImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">3.jpg</string>
- </object>
- </object>
- <object class="IBUIImageView" id="94701967">
- <reference key="NSNextResponder" ref="143169037"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrame">{{59, 540}, {202, 113}}</string>
- <reference key="NSSuperview" ref="143169037"/>
- <reference key="NSWindow"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <int key="IBUIContentMode">1</int>
- <bool key="IBUIUserInteractionEnabled">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <object class="NSCustomResource" key="IBUIImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">4.jpg</string>
- </object>
- </object>
- </array>
- <string key="NSFrameSize">{320, 683}</string>
- <reference key="NSSuperview" ref="734663765"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="401923886"/>
- <string key="NSReuseIdentifierKey">_NS:10</string>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace" id="214556140">
- <int key="NSID">2</int>
- </object>
- </object>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- </array>
- <string key="NSFrameSize">{360, 588}</string>
+ <string key="NSFrameSize">{320, 568}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="143169037"/>
- <string key="NSReuseIdentifierKey">_NS:10</string>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
<bool key="IBUIClipsSubviews">YES</bool>
- <bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBUIAlwaysBounceVertical">YES</bool>
+ <int key="IBUISeparatorStyle">1</int>
+ <int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
+ <bool key="IBUIAllowsSelection">NO</bool>
+ <bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
+ <float key="IBUIRowHeight">140</float>
+ <float key="IBUISectionHeaderHeight">22</float>
+ <float key="IBUISectionFooterHeight">22</float>
</object>
</array>
<string key="NSFrameSize">{320, 568}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="734663765"/>
+ <reference key="NSNextKeyView" ref="720695079"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
- <reference key="NSCustomColorSpace" ref="214556140"/>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
</object>
<object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics">
<string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string>
@@ -174,59 +101,27 @@
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">scrollView</string>
+ <string key="label">tableView</string>
<reference key="source" ref="372490531"/>
- <reference key="destination" ref="734663765"/>
+ <reference key="destination" ref="720695079"/>
</object>
- <int key="connectionID">28</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletCollectionConnection" key="connection">
- <string key="label">imageViews</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="521480597"/>
- <string key="cachedDesigntimeCollectionClassName">NSArray</string>
- <bool key="addsContentToExistingCollection">NO</bool>
- </object>
- <int key="connectionID">26</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletCollectionConnection" key="connection">
- <string key="label">imageViews</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="240106516"/>
- <string key="cachedDesigntimeCollectionClassName">NSArray</string>
- <bool key="addsContentToExistingCollection">NO</bool>
- </object>
- <int key="connectionID">25</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletCollectionConnection" key="connection">
- <string key="label">imageViews</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="401923886"/>
- <string key="cachedDesigntimeCollectionClassName">NSArray</string>
- <bool key="addsContentToExistingCollection">NO</bool>
- </object>
- <int key="connectionID">21</int>
+ <int key="connectionID">32</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">contentView</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="143169037"/>
+ <string key="label">dataSource</string>
+ <reference key="source" ref="720695079"/>
+ <reference key="destination" ref="372490531"/>
</object>
- <int key="connectionID">30</int>
+ <int key="connectionID">33</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletCollectionConnection" key="connection">
- <string key="label">imageViews</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="94701967"/>
- <string key="cachedDesigntimeCollectionClassName">NSArray</string>
- <bool key="addsContentToExistingCollection">NO</bool>
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="720695079"/>
+ <reference key="destination" ref="372490531"/>
</object>
- <int key="connectionID">27</int>
+ <int key="connectionID">34</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -241,7 +136,7 @@
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
- <reference ref="734663765"/>
+ <reference ref="720695079"/>
</array>
<reference key="parent" ref="0"/>
</object>
@@ -257,44 +152,10 @@
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">19</int>
- <reference key="object" ref="734663765"/>
- <array class="NSMutableArray" key="children">
- <reference ref="143169037"/>
- </array>
+ <int key="objectID">31</int>
+ <reference key="object" ref="720695079"/>
<reference key="parent" ref="191373211"/>
</object>
- <object class="IBObjectRecord">
- <int key="objectID">29</int>
- <reference key="object" ref="143169037"/>
- <array class="NSMutableArray" key="children">
- <reference ref="240106516"/>
- <reference ref="521480597"/>
- <reference ref="401923886"/>
- <reference ref="94701967"/>
- </array>
- <reference key="parent" ref="734663765"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3</int>
- <reference key="object" ref="240106516"/>
- <reference key="parent" ref="143169037"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">6</int>
- <reference key="object" ref="521480597"/>
- <reference key="parent" ref="143169037"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="401923886"/>
- <reference key="parent" ref="143169037"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">4</int>
- <reference key="object" ref="94701967"/>
- <reference key="parent" ref="143169037"/>
- </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -303,18 +164,13 @@
<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="19.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="29.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="3.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="31.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">30</int>
+ <int key="maxID">34</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -324,6 +180,7 @@
<dictionary class="NSMutableDictionary" key="outlets">
<string key="contentView">UIView</string>
<string key="scrollView">UIScrollView</string>
+ <string key="tableView">UITableView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="contentView">
@@ -334,6 +191,10 @@
<string key="name">scrollView</string>
<string key="candidateClassName">UIScrollView</string>
</object>
+ <object class="IBToOneOutletInfo" key="tableView">
+ <string key="name">tableView</string>
+ <string key="candidateClassName">UITableView</string>
+ </object>
</dictionary>
<object class="NSMutableDictionary" key="toManyOutletInfosByName">
<string key="NS.key.0">imageViews</string>
@@ -354,12 +215,6 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
- <string key="1.jpg">{320, 180}</string>
- <string key="2.jpg">{320, 180}</string>
- <string key="3.jpg">{320, 180}</string>
- <string key="4.jpg">{320, 180}</string>
- </dictionary>
<string key="IBCocoaTouchPluginVersion">1930</string>
</data>
</archive>
@@ -9,11 +9,12 @@
#import <UIKit/UIKit.h>
#import "ASMediaFocusManager.h"
-@interface ASMediaThumbnailsViewController : UIViewController <ASMediasFocusDelegate>
+@interface ASMediaThumbnailsViewController : UIViewController <ASMediasFocusDelegate, UITableViewDataSource, UITableViewDelegate>
@property (strong, nonatomic) IBOutletCollection(UIImageView) NSArray *imageViews;
@property (strong, nonatomic) ASMediaFocusManager *mediaFocusManager;
@property (strong, nonatomic) IBOutlet UIScrollView *scrollView;
@property (strong, nonatomic) IBOutlet UIView *contentView;
+@property (strong, nonatomic) IBOutlet UITableView *tableView;
@end
@@ -89,12 +89,52 @@ - (NSString *)mediaFocusManager:(ASMediaFocusManager *)mediaFocusManager mediaPa
{
NSString *path;
NSString *name;
+ NSInteger index;
+
+ if(self.tableView == nil)
+ {
+ index = ([self.imageViews indexOfObject:view] + 1);
+ }
+ else
+ {
+ index = view.tag;
+ }
// Here, images are accessed through their name "1f.jpg", "2f.jpg", …
- name = [NSString stringWithFormat:@"%df", ([self.imageViews indexOfObject:view] + 1)];
+ name = [NSString stringWithFormat:@"%df", index];
path = [[NSBundle mainBundle] pathForResource:name ofType:@"jpg"];
-
return path;
}
+#pragma mark - UITableViewDataSource
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ static NSString *cellIdentifier = @"Cell";
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
+ NSString *path;
+ UIImage *image;
+
+ if(cell == nil)
+ {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
+ [self.mediaFocusManager installOnView:cell.imageView];
+ }
+
+ path = [NSString stringWithFormat:@"%d.jpg", indexPath.row + 1];
+ image = [UIImage imageNamed:path];
+ cell.imageView.image = image;
+ cell.imageView.tag = indexPath.row + 1;
+
+ return cell;
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+ return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return 4;
+}
@end

0 comments on commit a3e58a3

Please sign in to comment.