ADBlock is blocking some content on the site

ADBlock errore

Using Kal calendar from existing table view and popToRootViewController not working

StackOverflow https://stackoverflow.com/questions/13216249


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"


  • 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:

setBackBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Back"

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.

No correct solution


Well, finally got it I think. I ended up removing the intermediary view controller. I think I just didn't understand what was going on earlier...I've now done the following:

  • instead of my main view controller (w/the existing tableview) being the delegate, I made the KalDataSource also be the UITableViewDelegate. So my DataSource handles both populating the calendar and selection of an event.

  • added id datasource as in ivar in main view controller

  • changed the "didSelectRowAtPath" method to:

    dataSource = [[EventsDataSource alloc] init];

    KalViewController *kal = [[KalViewController alloc] init]; [kal setDelegate:dataSource]; [kal setDataSource:dataSource]; [kal setTitle:@"Schedule"]; [self.navigationController pushViewController:kal animated:YES];

Everything now appears to be okay.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow