From e305debbe8c78f5a92b86d1e901edfdcbd0f0fcb Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 16 May 2015 08:34:54 -0700 Subject: [PATCH] whip --- Blog/Base.lproj/Main.storyboard | 9 +++++++++ Blog/PostsViewController.m | 29 ++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Blog/Base.lproj/Main.storyboard b/Blog/Base.lproj/Main.storyboard index ff15b30..e9067f8 100644 --- a/Blog/Base.lproj/Main.storyboard +++ b/Blog/Base.lproj/Main.storyboard @@ -376,6 +376,14 @@ wanted with as little input and thought as possible. + + + + + + + + @@ -444,6 +452,7 @@ wanted with as little input and thought as possible. + diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index 1c12bd9..3e56889 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -24,13 +24,14 @@ #import "MBProgressHUD.h" #import "CommonUI.h" -@interface PostsViewController () +@interface PostsViewController () @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