i want to refresh my main view on slide menu did select method with categorically
i have used SWRevealViewController to load my slide menu and its working fine but i cant understand how to assign delegate to the slide menu controller and use it?
here is the link for awesome library by john lusch
slide menu controller.h
@protocol SlideViewControllerDelegate
@required
-(void)menuViewControllerDidFinishWithCategoryId:(NSInteger)categoryId;
@end
@interface SlideViewController :
UIViewController<UITableViewDataSource,UITableViewDelegate>
{
__weak id<SlideViewControllerDelegate> slideDelegate;
}
@property (nonatomic, weak) id <SlideViewControllerDelegate> slideDelegate;
@end
slide menu controller.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.slideDelegate menuViewControllerDidFinishWithCategoryId:indexPath.row];
}
viewController.h
@interface ViewController : UIViewController<UITableViewDataSource,UITableViewDelegate,SlideViewControllerDelegate>
viewController.m
in my view did load method
SlideViewController *slideView = [[SlideViewController alloc]init];
slideView.slideDelegate = self;
- (void)menuViewControllerDidFinishWithCategoryId:(NSInteger)categoryId
{
self.categId = [catIdArray objectAtIndex:categoryId];
NSLog(@"cat id %@",categId);
[self getQuestions];
[self.feedTableView reloadData];
}
//Log above is never executed so i think may be i am wrong with assigning delegate to the swreveal view controller slide menu
得到它设置委托给揭秘控制器这样做
[(SlideViewController *)self.revealViewController.rearViewController setSlideDelegate:self];
Maybe you should init SlideViewController
by
- (id)initWithRearViewController:(UIViewController *)rearViewController frontViewController:(UIViewController *)frontViewController;
which says in the README.md
.
Remove that lines:
{
__weak id<SlideViewControllerDelegate> slideDelegate;
}
Your property:
@property (nonatomic, weak) id <SlideViewControllerDelegate> slideDelegate;
it's enought.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.