Skip to content

Commit 21448fe

Browse files
Initial Commit
This project demonstrates the use of UISearchController, introduced in iOS 8.
0 parents  commit 21448fe

File tree

19 files changed

+1187
-0
lines changed

19 files changed

+1187
-0
lines changed

ReadMe.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Sample-UISearchController Read Me
2+
=================================
3+
4+
This example demonstrates the use of the UISearchController class, introduced in iOS 8.
5+
6+
The project is based on the 'TableSearch' sample code from Apple. The original example used UISearchDisplayController which is deprecated in iOS 8.
7+
8+
**Version 1.0**
9+
*July 5, 2014*
10+
11+
This project was created with Xcode 6, Beta 2.
12+
13+
The initial version is essentially the original sample project, redone from scratch as an iOS 8 project, with as few changes in implementation as possible from the original sample project.
14+
15+
*Version 1.0 Notes:*
16+
- There is a build warning that the scrollable content size of the table view has ambiguous constraints. Choosing to 'Add Missing Constraints' in Interface Builder has no effect, and so this warning remains.
17+
18+
- The TableSearch sample project used a UISearchBar and UISearchDisplayController, configured in the storyboard. It does not appear that UISearchController can be configured in the similar way in Interface Builder at the moment. Therefore, it is created and configured in code. rdar://17563885
19+
20+
- The search results controller of the UISearchController does not seem to receive all of the appropriate view controller method calls. rdar://17566947

Sample-UISearchController.xcodeproj/project.pbxproj

Lines changed: 439 additions & 0 deletions
Large diffs are not rendered by default.

Sample-UISearchController.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0600"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "530D5EF61967816C009E7D8D"
18+
BuildableName = "Sample-UISearchController.app"
19+
BlueprintName = "Sample-UISearchController"
20+
ReferencedContainer = "container:Sample-UISearchController.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
27+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28+
shouldUseLaunchSchemeArgsEnv = "YES"
29+
buildConfiguration = "Debug">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "530D5F0C1967816C009E7D8D"
36+
BuildableName = "Sample-UISearchControllerTests.xctest"
37+
BlueprintName = "Sample-UISearchControllerTests"
38+
ReferencedContainer = "container:Sample-UISearchController.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "530D5EF61967816C009E7D8D"
46+
BuildableName = "Sample-UISearchController.app"
47+
BlueprintName = "Sample-UISearchController"
48+
ReferencedContainer = "container:Sample-UISearchController.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
</TestAction>
52+
<LaunchAction
53+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
54+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
55+
launchStyle = "0"
56+
useCustomWorkingDirectory = "NO"
57+
buildConfiguration = "Debug"
58+
ignoresPersistentStateOnLaunch = "NO"
59+
debugDocumentVersioning = "YES"
60+
allowLocationSimulation = "YES">
61+
<BuildableProductRunnable>
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "530D5EF61967816C009E7D8D"
65+
BuildableName = "Sample-UISearchController.app"
66+
BlueprintName = "Sample-UISearchController"
67+
ReferencedContainer = "container:Sample-UISearchController.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
<AdditionalOptions>
71+
</AdditionalOptions>
72+
</LaunchAction>
73+
<ProfileAction
74+
shouldUseLaunchSchemeArgsEnv = "YES"
75+
savedToolIdentifier = ""
76+
useCustomWorkingDirectory = "NO"
77+
buildConfiguration = "Release"
78+
debugDocumentVersioning = "YES">
79+
<BuildableProductRunnable>
80+
<BuildableReference
81+
BuildableIdentifier = "primary"
82+
BlueprintIdentifier = "530D5EF61967816C009E7D8D"
83+
BuildableName = "Sample-UISearchController.app"
84+
BlueprintName = "Sample-UISearchController"
85+
ReferencedContainer = "container:Sample-UISearchController.xcodeproj">
86+
</BuildableReference>
87+
</BuildableProductRunnable>
88+
</ProfileAction>
89+
<AnalyzeAction
90+
buildConfiguration = "Debug">
91+
</AnalyzeAction>
92+
<ArchiveAction
93+
buildConfiguration = "Release"
94+
revealArchiveInOrganizer = "YES">
95+
</ArchiveAction>
96+
</Scheme>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6154.21" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="zEY-H5-Xk0">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6153.13"/>
5+
</dependencies>
6+
<scenes>
7+
<!--Master View Controller - Products-->
8+
<scene sceneID="FCO-Cd-yKz">
9+
<objects>
10+
<tableViewController storyboardIdentifier="MasterViewController" id="wER-c4-mse" customClass="TPSMasterViewController" sceneMemberID="viewController">
11+
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="h0p-ar-kHG">
12+
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
13+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
14+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
15+
<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/>
16+
<prototypes>
17+
<tableViewCell contentMode="scaleToFill" ambiguous="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="ProductCell" textLabel="z1m-eU-rxL" style="IBUITableViewCellStyleDefault" id="pcI-Lx-mJk">
18+
<autoresizingMask key="autoresizingMask"/>
19+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pcI-Lx-mJk" id="4lG-jS-OQc">
20+
<autoresizingMask key="autoresizingMask"/>
21+
<subviews>
22+
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="z1m-eU-rxL">
23+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
24+
<fontDescription key="fontDescription" type="system" pointSize="16"/>
25+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
26+
<nil key="highlightedColor"/>
27+
</label>
28+
</subviews>
29+
</tableViewCellContentView>
30+
<connections>
31+
<segue destination="rTx-hZ-572" kind="show" identifier="pushDetailView" id="1Mo-vg-WMa"/>
32+
</connections>
33+
</tableViewCell>
34+
</prototypes>
35+
<connections>
36+
<outlet property="dataSource" destination="wER-c4-mse" id="cOe-Cz-FTZ"/>
37+
<outlet property="delegate" destination="wER-c4-mse" id="tYk-Gf-E4R"/>
38+
</connections>
39+
</tableView>
40+
<navigationItem key="navigationItem" title="Products" id="Uua-xr-Qrk"/>
41+
</tableViewController>
42+
<placeholder placeholderIdentifier="IBFirstResponder" id="E8Q-7w-EEP" userLabel="First Responder" sceneMemberID="firstResponder"/>
43+
</objects>
44+
<point key="canvasLocation" x="277" y="373"/>
45+
</scene>
46+
<!--Detail View Controller-->
47+
<scene sceneID="oP0-Fa-FuL">
48+
<objects>
49+
<viewController storyboardIdentifier="DetailViewController" id="rTx-hZ-572" customClass="TPSDetailViewController" sceneMemberID="viewController">
50+
<layoutGuides>
51+
<viewControllerLayoutGuide type="top" id="Bvm-8e-edD"/>
52+
<viewControllerLayoutGuide type="bottom" id="sC9-yb-0AH"/>
53+
</layoutGuides>
54+
<view key="view" contentMode="scaleToFill" id="nLD-QP-EEQ">
55+
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
56+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
57+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
58+
<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/>
59+
</view>
60+
</viewController>
61+
<placeholder placeholderIdentifier="IBFirstResponder" id="AFB-gV-8de" userLabel="First Responder" sceneMemberID="firstResponder"/>
62+
</objects>
63+
<point key="canvasLocation" x="866" y="373"/>
64+
</scene>
65+
<!--Navigation Controller-->
66+
<scene sceneID="yrx-zo-X2J">
67+
<objects>
68+
<navigationController id="zEY-H5-Xk0" sceneMemberID="viewController">
69+
<navigationBar key="navigationBar" contentMode="scaleToFill" id="wFT-2j-Cos">
70+
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
71+
<autoresizingMask key="autoresizingMask"/>
72+
</navigationBar>
73+
<connections>
74+
<segue destination="wER-c4-mse" kind="relationship" relationship="rootViewController" id="fqL-4K-uhr"/>
75+
</connections>
76+
</navigationController>
77+
<placeholder placeholderIdentifier="IBFirstResponder" id="p5o-FW-pbd" userLabel="First Responder" sceneMemberID="firstResponder"/>
78+
</objects>
79+
<point key="canvasLocation" x="-297" y="373"/>
80+
</scene>
81+
</scenes>
82+
</document>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "29x29",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "40x40",
11+
"scale" : "2x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "60x60",
16+
"scale" : "2x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"orientation" : "portrait",
5+
"idiom" : "iphone",
6+
"extent" : "full-screen",
7+
"minimum-system-version" : "7.0",
8+
"scale" : "2x"
9+
},
10+
{
11+
"orientation" : "portrait",
12+
"idiom" : "iphone",
13+
"subtype" : "retina4",
14+
"extent" : "full-screen",
15+
"minimum-system-version" : "7.0",
16+
"scale" : "2x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}

Sample-UISearchController/Info.plist

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>${EXECUTABLE_NAME}</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>net.tapas-software.${PRODUCT_NAME:rfc1034identifier}</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>${PRODUCT_NAME}</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>LSRequiresIPhoneOS</key>
24+
<true/>
25+
<key>UIMainStoryboardFile</key>
26+
<string>Main</string>
27+
<key>UIRequiredDeviceCapabilities</key>
28+
<array>
29+
<string>armv7</string>
30+
</array>
31+
</dict>
32+
</plist>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// TPSAppDelegate.h
3+
// Sample-UISearchController
4+
//
5+
// Created by James Dempsey on 7/4/14.
6+
// Copyright (c) 2014 Tapas Software. All rights reserved.
7+
//
8+
// Based on Apple sample code TableSearch version 2.0
9+
//
10+
11+
#import <UIKit/UIKit.h>
12+
13+
@interface TPSAppDelegate : UIResponder <UIApplicationDelegate>
14+
15+
@property (strong, nonatomic) UIWindow *window;
16+
17+
@end
18+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// TPSAppDelegate.m
3+
// Sample-UISearchController
4+
//
5+
// Created by James Dempsey on 7/4/14.
6+
// Copyright (c) 2014 Tapas Software. All rights reserved.
7+
//
8+
// Based on Apple sample code TableSearch version 2.0
9+
//
10+
11+
#import "TPSAppDelegate.h"
12+
#import "TPSMasterViewController.h"
13+
#import "TPSProduct.h"
14+
15+
@interface TPSAppDelegate ()
16+
@end
17+
18+
@implementation TPSAppDelegate
19+
20+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
21+
NSArray *productArray = @[[TPSProduct productWithType:ProductTypeDevice name:@"iPhone"],
22+
[TPSProduct productWithType:ProductTypeDevice name:@"iPod"],
23+
[TPSProduct productWithType:ProductTypeDevice name:@"iPod touch"],
24+
[TPSProduct productWithType:ProductTypeDevice name:@"iPad"],
25+
[TPSProduct productWithType:ProductTypeDevice name:@"iPad mini"],
26+
[TPSProduct productWithType:ProductTypeDevice name:@"iPad Air"],
27+
[TPSProduct productWithType:ProductTypeDesktop name:@"iMac"],
28+
[TPSProduct productWithType:ProductTypeDesktop name:@"Mac Pro"],
29+
[TPSProduct productWithType:ProductTypeDesktop name:@"Mac mini"],
30+
[TPSProduct productWithType:ProductTypePortable name:@"MacBook"],
31+
[TPSProduct productWithType:ProductTypePortable name:@"MacBook Air"],
32+
[TPSProduct productWithType:ProductTypePortable name:@"MacBook Pro"]];
33+
34+
UINavigationController *navigationController = (UINavigationController *)[self.window rootViewController];
35+
TPSMasterViewController *viewController = [navigationController.viewControllers objectAtIndex:0];
36+
viewController.products = productArray;
37+
38+
return YES;
39+
}
40+
41+
@end
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// TPSDetailViewController.h
3+
// Sample-UISearchController
4+
//
5+
// Created by James Dempsey on 7/4/14.
6+
// Copyright (c) 2014 Tapas Software. All rights reserved.
7+
//
8+
// Based on Apple sample code TableSearch version 2.0
9+
//
10+
11+
#import <UIKit/UIKit.h>
12+
13+
@class TPSProduct;
14+
15+
@interface TPSDetailViewController : UIViewController
16+
17+
@property (nonatomic, strong) TPSProduct *product;
18+
19+
@end
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// TPSDetailViewController.m
3+
// Sample-UISearchController
4+
//
5+
// Created by James Dempsey on 7/4/14.
6+
// Copyright (c) 2014 Tapas Software. All rights reserved.
7+
//
8+
// Based on Apple sample code TableSearch version 2.0
9+
//
10+
11+
#import "TPSDetailViewController.h"
12+
#import "TPSProduct.h"
13+
14+
@interface TPSDetailViewController ()
15+
@end
16+
17+
@implementation TPSDetailViewController
18+
19+
- (void)viewDidLoad {
20+
[super viewDidLoad];
21+
self.title = self.product.name;
22+
}
23+
24+
@end

0 commit comments

Comments
 (0)