This commit is contained in:
Sami Samhuri 2015-05-16 08:34:54 -07:00
parent d57ece42ba
commit e305debbe8
2 changed files with 37 additions and 1 deletions

View file

@ -376,6 +376,14 @@ wanted with as little input and thought as possible.</string>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="tintColor" red="0.7953414352" green="0.0" blue="0.013255690590000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<searchBar key="tableHeaderView" contentMode="redraw" searchBarStyle="minimal" placeholder="Search" id="QTr-jX-TNh">
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<textInputTraits key="textInputTraits" returnKeyType="search" enablesReturnKeyAutomatically="YES"/>
<connections>
<outlet property="delegate" destination="7bK-jq-Zjz" id="1Ht-4q-Rno"/>
</connections>
</searchBar>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" id="WCw-Qf-5nD" customClass="PostCell">
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
@ -444,6 +452,7 @@ wanted with as little input and thought as possible.</string>
<connections>
<outlet property="addButton" destination="u2a-vi-nHQ" id="BNL-ge-ZGw"/>
<outlet property="publishButton" destination="8HS-W8-a6l" id="amK-fb-yQq"/>
<outlet property="searchBar" destination="QTr-jX-TNh" id="2h7-g8-bYJ"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>

View file

@ -24,13 +24,14 @@
#import "MBProgressHUD.h"
#import "CommonUI.h"
@interface PostsViewController ()
@interface PostsViewController () <UISearchBarDelegate>
@property (nonatomic, strong) NSArray *postCollections;
@property (nonatomic, readonly, strong) NSMutableArray *drafts;
@property (nonatomic, readonly, strong) NSMutableArray *publishedPosts;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *publishButton;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *addButton;
@property (nonatomic, weak) IBOutlet UISearchBar *searchBar;
@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UILabel *statusLabel;
@property (nonatomic, copy) NSString *blogStatusText;
@ -518,4 +519,30 @@ static NSString *const StateRestorationBlogStatusTextKey = @"blogStatusText";
}
}
#pragma mark - UISearchBarDelegate methods
- (void)filterPosts:(NSString *)text {
if (text.length) {
}
else {
}
[self.tableView reloadData];
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
// [self filterPosts:searchText];
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
// [self filterPosts:nil];
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
// [self filterPosts:self.searchBar.text];
}
@end