Skip to content

Commit e23e1ae

Browse files
stevetreaseSteve Trease
authored andcommitted
Added "x of y" count to bottom of tableview controller to show count of search results.
1 parent 118fbd9 commit e23e1ae

File tree

7 files changed

+90
-4
lines changed

7 files changed

+90
-4
lines changed

Swift Push 4.xcodeproj/xcuserdata/steve.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,69 @@
22
<Bucket
33
type = "1"
44
version = "2.0">
5+
<Breakpoints>
6+
<BreakpointProxy
7+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
8+
<BreakpointContent
9+
shouldBeEnabled = "No"
10+
ignoreCount = "0"
11+
continueAfterRunningActions = "No"
12+
filePath = "Swift Push 4/MasterViewController.swift"
13+
timestampString = "463089341.421694"
14+
startingColumnNumber = "9223372036854775807"
15+
endingColumnNumber = "9223372036854775807"
16+
startingLineNumber = "11"
17+
endingLineNumber = "11"
18+
landmarkName = "MasterViewController"
19+
landmarkType = "3">
20+
<Locations>
21+
<Location
22+
shouldBeEnabled = "No"
23+
ignoreCount = "0"
24+
continueAfterRunningActions = "No"
25+
symbolName = "Swift_Push_4.MasterViewController.init (Swift_Push_4.MasterViewController.Type)(style : C.UITableViewStyle) -&gt; Swift_Push_4.MasterViewController"
26+
moduleName = "Swift Push 4"
27+
usesParentBreakpointCondition = "Yes"
28+
urlString = "file:///Users/steve/Dropbox/Documents/Development/XCode/Swift%20Push/Swift%20Push%204/MasterViewController.swift"
29+
timestampString = "463089657.523228"
30+
startingColumnNumber = "9223372036854775807"
31+
endingColumnNumber = "9223372036854775807"
32+
startingLineNumber = "15"
33+
endingLineNumber = "15"
34+
offsetFromSymbolStart = "25">
35+
</Location>
36+
<Location
37+
shouldBeEnabled = "No"
38+
ignoreCount = "0"
39+
continueAfterRunningActions = "No"
40+
symbolName = "Swift_Push_4.MasterViewController.init (Swift_Push_4.MasterViewController.Type)(nibName : Swift.Optional&lt;Swift.String&gt;, bundle : Swift.Optional&lt;ObjectiveC.NSBundle&gt;) -&gt; Swift_Push_4.MasterViewController"
41+
moduleName = "Swift Push 4"
42+
usesParentBreakpointCondition = "Yes"
43+
urlString = "file:///Users/steve/Dropbox/Documents/Development/XCode/Swift%20Push/Swift%20Push%204/MasterViewController.swift"
44+
timestampString = "463089657.523375"
45+
startingColumnNumber = "9223372036854775807"
46+
endingColumnNumber = "9223372036854775807"
47+
startingLineNumber = "15"
48+
endingLineNumber = "15"
49+
offsetFromSymbolStart = "67">
50+
</Location>
51+
<Location
52+
shouldBeEnabled = "No"
53+
ignoreCount = "0"
54+
continueAfterRunningActions = "No"
55+
symbolName = "Swift_Push_4.MasterViewController.init (Swift_Push_4.MasterViewController.Type)(coder : ObjectiveC.NSCoder) -&gt; Swift.Optional&lt;Swift_Push_4.MasterViewController&gt;"
56+
moduleName = "Swift Push 4"
57+
usesParentBreakpointCondition = "Yes"
58+
urlString = "file:///Users/steve/Dropbox/Documents/Development/XCode/Swift%20Push/Swift%20Push%204/MasterViewController.swift"
59+
timestampString = "463089657.523513"
60+
startingColumnNumber = "9223372036854775807"
61+
endingColumnNumber = "9223372036854775807"
62+
startingLineNumber = "15"
63+
endingLineNumber = "15"
64+
offsetFromSymbolStart = "27">
65+
</Location>
66+
</Locations>
67+
</BreakpointContent>
68+
</BreakpointProxy>
69+
</Breakpoints>
570
</Bucket>

Swift Push 4/AppDelegate.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3535
notifications.insert(item, atIndex: 0)
3636

3737
// display an additional set of test notifications
38-
38+
/*
3939
let formatter = NSNumberFormatter()
4040
formatter.numberStyle = NSNumberFormatterStyle.SpellOutStyle
4141
for i in 1...10 {
4242
item = NotificationData()
4343
item.alert = "test data " + formatter.stringFromNumber(i)!
4444
notifications.insert(item, atIndex: 0)
4545
}
46+
*/
4647

4748

4849
let types: UIUserNotificationType =

Swift Push 4/Base.lproj/Main.storyboard

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
3131
<animations/>
3232
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
33+
<label key="tableFooterView" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsLetterSpacingToFitWidth="YES" adjustsFontSizeToFit="NO" id="T3o-hA-yTa">
34+
<rect key="frame" x="0.0" y="130" width="600" height="44"/>
35+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
36+
<animations/>
37+
<fontDescription key="fontDescription" type="system" pointSize="10"/>
38+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
39+
<nil key="highlightedColor"/>
40+
</label>
3341
<prototypes>
3442
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" detailTextLabel="su6-nF-v8b" style="IBUITableViewCellStyleSubtitle" id="WCw-Qf-5nD">
3543
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
@@ -68,6 +76,9 @@
6876
</connections>
6977
</tableView>
7078
<navigationItem key="navigationItem" title="Swift Push" id="zC9-kQ-Edd"/>
79+
<connections>
80+
<outlet property="countLabel" destination="T3o-hA-yTa" id="TqR-az-eRf"/>
81+
</connections>
7182
</tableViewController>
7283
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
7384
</objects>

Swift Push 4/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>567</string>
22+
<string>589</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UIBackgroundModes</key>

Swift Push 4/MasterViewController.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import UIKit
1010

1111
class MasterViewController: UITableViewController, UISearchResultsUpdating {
12+
13+
@IBOutlet weak var countLabel: UILabel!
1214

1315
var filteredNotifications = [NotificationData]()
1416
var resultSearchController = UISearchController()
@@ -32,7 +34,7 @@ class MasterViewController: UITableViewController, UISearchResultsUpdating {
3234
controller.dimsBackgroundDuringPresentation = false
3335
controller.hidesNavigationBarDuringPresentation = false
3436
controller.searchBar.sizeToFit()
35-
37+
3638
self.tableView.tableHeaderView = controller.searchBar
3739
return controller
3840
})()
@@ -59,10 +61,17 @@ class MasterViewController: UITableViewController, UISearchResultsUpdating {
5961
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
6062
if (self.resultSearchController.active) {
6163
print("filtered")
64+
if ((self.filteredNotifications.count == 0) || (notifications.count == self.filteredNotifications.count)) {
65+
countLabel.hidden = true
66+
} else {
67+
countLabel.hidden = false
68+
countLabel.text = "\(self.filteredNotifications.count) of \(notifications.count)"
69+
}
6270
return self.filteredNotifications.count
6371
}
6472
else {
6573
print("unfiltered")
74+
countLabel.hidden = true
6675
return notifications.count
6776
}
6877
}

Swift Push 4/Settings.bundle/Root.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<array>
77
<dict>
88
<key>DefaultValue</key>
9-
<string>567</string>
9+
<string>589</string>
1010
<key>Key</key>
1111
<string>CurrentBuildNumber</string>
1212
<key>Title</key>

0 commit comments

Comments
 (0)