Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Search IPAs by name

  • Loading branch information...
commit cec8d757555f20a90c1dd04a1c14e05f81e4268b 1 parent c81cc31
Cédric Luthi authored
43 Classes/IPAViewController.m
View
@@ -11,6 +11,7 @@
#import "AppDelegate.h"
#import "ArtworkViewController.h"
#import "IPAArchive.h"
+#import "NSString+IPAArchive.h"
@implementation IPAViewController
@@ -19,7 +20,10 @@ @implementation IPAViewController
- (void) reloadRowsAtIndexPaths:(NSArray *)indexPaths
{
if ([NSThread isMainThread])
+ {
[self.tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
+ [self.searchDisplayController.searchResultsTableView reloadData];
+ }
else
[self performSelectorOnMainThread:_cmd withObject:indexPaths waitUntilDone:NO];
}
@@ -55,16 +59,9 @@ - (void) loadArchives
[archivePool drain];
}
- [self performSelectorOnMainThread:@selector(archivesDidLoad) withObject:nil waitUntilDone:NO];
-
[pool drain];
}
-- (void) archivesDidLoad
-{
- [self.tableView reloadData];
-}
-
- (void) viewDidLoad
{
self.title = self.tabBarItem.title;
@@ -80,9 +77,22 @@ - (void) viewDidUnload
// MARK: - UITableView data source
+- (NSMutableArray *) archivesForTableView:(UITableView *)tableView
+{
+ NSMutableArray *archives = self.archives;
+ if (tableView == self.searchDisplayController.searchResultsTableView)
+ {
+ NSString *searchText = [NSString stringWithFormat:@"*%@*", self.searchDisplayController.searchBar.text];
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"appName LIKE[c] %@", searchText];
+ archives = [NSMutableArray arrayWithArray:[archives filteredArrayUsingPredicate:predicate]];
+ }
+
+ return archives;
+}
+
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
- return [self.archives count];
+ return [[self archivesForTableView:tableView] count];
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@@ -98,25 +108,34 @@ - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(
- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
- IPAArchive *archive = [self.archives objectAtIndex:indexPath.row];
+ IPAArchive *archive = [[self archivesForTableView:tableView] objectAtIndex:indexPath.row];
NSString *path = [archive isKindOfClass:[IPAArchive class]] ? archive.path : (NSString *)archive;
UIImage *icon = [archive isKindOfClass:[IPAArchive class]] ? archive.appIcon : [UIImage imageNamed:@"Unknown.png"];
- cell.textLabel.text = [[path lastPathComponent] stringByDeletingPathExtension];
+ cell.textLabel.text = [path appName];
cell.imageView.image = icon;
}
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
- IPAArchive *archive = [self.archives objectAtIndex:indexPath.row];
+ NSMutableArray *archives = [self archivesForTableView:tableView];
+ IPAArchive *archive = [archives objectAtIndex:indexPath.row];
if (![archive isKindOfClass:[IPAArchive class]])
{
NSString *path = (NSString *)archive;
archive = [[[IPAArchive alloc] initWithPath:path] autorelease];
- [self.archives replaceObjectAtIndex:indexPath.row withObject:archive];
+ [archives replaceObjectAtIndex:indexPath.row withObject:archive];
}
ArtworkViewController *artworkViewController = [[[ArtworkViewController alloc] initWithArchive:archive] autorelease];
[self.navigationController pushViewController:artworkViewController animated:YES];
}
+// MARK: - Search Display Delegate
+
+- (void) searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView
+{
+ tableView.backgroundColor = self.tableView.backgroundColor;
+ tableView.rowHeight = self.tableView.rowHeight;
+}
+
@end
15 Classes/NSString+IPAArchive.h
View
@@ -0,0 +1,15 @@
+//
+// NSString+IPAArchive.h
+// UIKit Artwork Extractor
+//
+// Created by Cédric Luthi on 09.01.12.
+// Copyright (c) 2012 Cédric Luthi. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface NSString (IPAArchive)
+
+- (NSString *) appName;
+
+@end
18 Classes/NSString+IPAArchive.m
View
@@ -0,0 +1,18 @@
+//
+// NSString+IPAArchive.m
+// UIKit Artwork Extractor
+//
+// Created by Cédric Luthi on 09.01.12.
+// Copyright (c) 2012 Cédric Luthi. All rights reserved.
+//
+
+#import "NSString+IPAArchive.h"
+
+@implementation NSString (IPAArchive)
+
+- (NSString *) appName
+{
+ return [[self lastPathComponent] stringByDeletingPathExtension];
+}
+
+@end
115 IPAViewController.xib
View
@@ -11,8 +11,10 @@
<string key="NS.object.0">933</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
- <string>IBProxyObject</string>
+ <string>IBUISearchDisplayController</string>
<string>IBUITableView</string>
+ <string>IBUISearchBar</string>
+ <string>IBProxyObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -33,9 +35,24 @@
<object class="IBUITableView" id="687842835">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUISearchBar" id="465005046">
+ <reference key="NSNextResponder" ref="687842835"/>
+ <int key="NSvFlags">290</int>
+ <string key="NSFrameSize">{320, 44}</string>
+ <reference key="NSSuperview" ref="687842835"/>
+ <reference key="NSWindow"/>
+ <int key="IBUIContentMode">3</int>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <object class="IBUITextInputTraits" key="IBTextInputTraits">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </object>
+ </array>
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC43NQA</bytes>
@@ -52,6 +69,10 @@
<float key="IBUIRowHeight">44</float>
<float key="IBUISectionHeaderHeight">22</float>
<float key="IBUISectionFooterHeight">22</float>
+ <reference key="IBUITableHeaderView" ref="465005046"/>
+ </object>
+ <object class="IBUISearchDisplayController" id="1054454063">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -64,6 +85,62 @@
</object>
<int key="connectionID">4</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">searchDisplayController</string>
+ <reference key="source" ref="841351856"/>
+ <reference key="destination" ref="1054454063"/>
+ </object>
+ <int key="connectionID">15</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="465005046"/>
+ <reference key="destination" ref="841351856"/>
+ </object>
+ <int key="connectionID">20</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">searchContentsController</string>
+ <reference key="source" ref="1054454063"/>
+ <reference key="destination" ref="841351856"/>
+ </object>
+ <int key="connectionID">16</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">searchResultsDataSource</string>
+ <reference key="source" ref="1054454063"/>
+ <reference key="destination" ref="841351856"/>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">searchResultsDelegate</string>
+ <reference key="source" ref="1054454063"/>
+ <reference key="destination" ref="841351856"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="1054454063"/>
+ <reference key="destination" ref="841351856"/>
+ </object>
+ <int key="connectionID">19</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">searchBar</string>
+ <reference key="source" ref="1054454063"/>
+ <reference key="destination" ref="465005046"/>
+ </object>
+ <int key="connectionID">14</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -87,8 +164,21 @@
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="687842835"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="465005046"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">13</int>
+ <reference key="object" ref="1054454063"/>
<reference key="parent" ref="0"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">12</int>
+ <reference key="object" ref="465005046"/>
+ <reference key="parent" ref="687842835"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -96,38 +186,21 @@
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="2.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">11</int>
+ <int key="maxID">20</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">IPAViewController</string>
<string key="superclassName">UITableViewController</string>
- <dictionary class="NSMutableDictionary" key="outlets">
- <string key="appNameLabel">UILabel</string>
- <string key="archiveLoadingView">UIView</string>
- <string key="progressView">UIProgressView</string>
- </dictionary>
- <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
- <object class="IBToOneOutletInfo" key="appNameLabel">
- <string key="name">appNameLabel</string>
- <string key="candidateClassName">UILabel</string>
- </object>
- <object class="IBToOneOutletInfo" key="archiveLoadingView">
- <string key="name">archiveLoadingView</string>
- <string key="candidateClassName">UIView</string>
- </object>
- <object class="IBToOneOutletInfo" key="progressView">
- <string key="name">progressView</string>
- <string key="candidateClassName">UIProgressView</string>
- </object>
- </dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/IPAViewController.h</string>
6 UIKit Artwork Extractor.xcodeproj/project.pbxproj
View
@@ -53,6 +53,7 @@
DAB5337B14B3C65500EDDE37 /* IPA@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB5337914B3C65500EDDE37 /* IPA@2x.png */; };
DAB5337D14B3C67500EDDE37 /* IPAViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DAB5337C14B3C67500EDDE37 /* IPAViewController.xib */; };
DAC796A011FD71E100A33F28 /* ArtworkDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DAC7969F11FD71E100A33F28 /* ArtworkDetailViewController.xib */; };
+ DAD7253F14BB9A80001ED756 /* NSString+IPAArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD7253E14BB9A7F001ED756 /* NSString+IPAArchive.m */; };
DAF387911211AF30003DF2B8 /* UITintedGlassButtonHighlight@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAF3878D1211AF30003DF2B8 /* UITintedGlassButtonHighlight@2x.png */; };
DAF387921211AF30003DF2B8 /* UITintedGlassButtonMask@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAF3878E1211AF30003DF2B8 /* UITintedGlassButtonMask@2x.png */; };
DAF387931211AF30003DF2B8 /* UITintedGlassButtonShadow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAF3878F1211AF30003DF2B8 /* UITintedGlassButtonShadow@2x.png */; };
@@ -134,6 +135,8 @@
DAB5337914B3C65500EDDE37 /* IPA@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "IPA@2x.png"; path = "Resources/IPA@2x.png"; sourceTree = "<group>"; };
DAB5337C14B3C67500EDDE37 /* IPAViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IPAViewController.xib; sourceTree = SOURCE_ROOT; };
DAC7969F11FD71E100A33F28 /* ArtworkDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ArtworkDetailViewController.xib; path = ../ArtworkDetailViewController.xib; sourceTree = "<group>"; };
+ DAD7253D14BB9A7F001ED756 /* NSString+IPAArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+IPAArchive.h"; sourceTree = "<group>"; };
+ DAD7253E14BB9A7F001ED756 /* NSString+IPAArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+IPAArchive.m"; sourceTree = "<group>"; };
DAF3878D1211AF30003DF2B8 /* UITintedGlassButtonHighlight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "UITintedGlassButtonHighlight@2x.png"; sourceTree = "<group>"; };
DAF3878E1211AF30003DF2B8 /* UITintedGlassButtonMask@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "UITintedGlassButtonMask@2x.png"; sourceTree = "<group>"; };
DAF3878F1211AF30003DF2B8 /* UITintedGlassButtonShadow@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "UITintedGlassButtonShadow@2x.png"; sourceTree = "<group>"; };
@@ -171,6 +174,8 @@
DA9AD658138FC3B200BDC968 /* FindSymbol.c */,
DA8BF5B7112EAC4E0044106B /* GlossyButtonViewController.h */,
DA8BF5B8112EAC4E0044106B /* GlossyButtonViewController.m */,
+ DAD7253D14BB9A7F001ED756 /* NSString+IPAArchive.h */,
+ DAD7253E14BB9A7F001ED756 /* NSString+IPAArchive.m */,
DAB5332D14B3C38400EDDE37 /* IPAArchive.h */,
DAB5332E14B3C38400EDDE37 /* IPAArchive.m */,
DAB5332F14B3C38400EDDE37 /* IPAViewController.h */,
@@ -418,6 +423,7 @@
DAB5336F14B3C39D00EDDE37 /* ZKFileArchive.m in Sources */,
DAB5337014B3C39D00EDDE37 /* ZKLFHeader.m in Sources */,
DAB5337114B3C39D00EDDE37 /* ZKLog.m in Sources */,
+ DAD7253F14BB9A80001ED756 /* NSString+IPAArchive.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Please sign in to comment.
Something went wrong with that request. Please try again.