I'm trying use Kal calendar in my project. Here is what I understand to be the case so far:
- Whichever view controller that calls Kal must implement the UITableViewDelegate method "didSelectRowAtPath"
Issue:
- My view controller that calls Kal already has an existing tableview (one of the cells would call Kal)
To solve this, I've attempted to push an intermediary view controller from a cell in my main tableview as follows:
ScheduleViewController *svc = [[ScheduleViewController alloc] init];
[svc setTitle:@"Schedule"];
[self.navigationController pushViewController:svc animated:YES];
From ScheduleViewController's viewDidLoad, I'm pushing the actual Kal calendar:
KalViewController *kal = [[KalViewController alloc] init];
[kal setDelegate:self];
[kal setTitle:@"Schedule"];
[self.navigationController pushViewController:kal animated:NO];
So once I do this, I can get the calendar to show up. However, I can't seem to cleanly get back to my main menu using the back button. I created a back button in ScheduleViewController:
[kal.navigationItem
setBackBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(test)]];
I've put this in a few different places (viewDidLoad, viewWillAppear) and can't get it to work. When I click "Back" it still goes to ScheduleViewController instead of all the way back. "test" never gets called. I've tried popToRootViewController, [[self.presentingViewController presentingViewController] dismissViewController], and a few others. Just doesn't want to work.
- Is this the best way to go about using Kal?
- How can I popToRootViewController (skipping ScheduleViewController) using this method?
Thanks! This is my first post so please let me know if there's anything I can do to make the question less confusing.