gresrun / GHSidebarNav

A clone of the new Facebook iOS UI paradigm
Apache License 2.0
607 stars 136 forks source link

searchResult behavior #5

Closed mayous closed 11 years ago

mayous commented 11 years ago

Hi Greg,

Thank you for your nicely library ;)

However i have a problem with the search result behavior. I would like to push detailViewController when someone select a row but there is not navigationController so it is not possible.

I found a solution but it is not the best way. Using [self presentViewController: animated: completion:]; on this delegate - (void)searchResult:(id)result selectedAtIndexPath:(NSIndexPath *)indexPath;

i would love to see the same behavior when you present a GHRootViewController on the GHMenuViewController. I tried to do it but i had strange bug.

Do you have something in your mind ?

Antoine

gresrun commented 11 years ago

Antoine,

If I understand your question correctly, you would like a way to hide the search controller and present a content view controller when a search result is tapped.

This can be accomplished by implementing the GHSidebarSearchViewControllerDelegate like so:

@interface MYSearchDelegate <GHSidebarSearchViewControllerDelegate>
@property (strong, nonatomic) GHRevealViewController *revealVC;
@end 
@implementation MYSearchDelegate
@synthesize revealVC;

- (void)searchResult:(id)result selectedAtIndexPath:(NSIndexPath *)indexPath {
    self.revealVC.contentViewController = // Create view controller based on result and/or indexPath
    [self.revealVC toggleSidebar:NO duration:kGHRevealSidebarDefaultAnimationDuration];
}

- (void)searchResultsForText:(NSString *)text withScope:(NSString *)scope callback:(SearchResultsBlock)callback {
    // Your logic here
}

- (UITableViewCell *)searchResultCellForEntry:(id)entry atIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView {
    // Your logic here
}
@end 
mayous commented 11 years ago

Thank you for your fast answer.

However, i tried the same thing on your demo project and it does not work, nothing really happened. I know your library is compatible just on IOS 5 and i'm running it on IOS 6. It is maybe the problem...

Edit : I tried on IOS 5 and it does not work too.

gresrun commented 11 years ago

OK, I've just spent the last few days working on this:

https://github.com/gresrun/GHSidebarNav/tree/Storyboard

It is an attempt to use storyboards as much as possible. Only works with iOS 6, as it uses the latest and greatest.

It includes some changes to the search delegate to resolve the issue you uncovered, among many other changes.

mayous commented 11 years ago

It is working great and your code is cleaner.

However, I am trying to remove all reference to storyboards... so it will take me some time to create a clean project but at this time it is working great.

Thanks you

P.S : I do not understand what i need to do programmatically with all the delegate which i need to connect between the controller "GHMenuViewController" and the new helper GHSidebarSearchHelper.