jivesoftware / PDTSimpleCalendar

A simple Calendar / Date Picker for iOS using UICollectionView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with Segue when using the PTDSimpleCalendarViewController

artangco opened this issue · comments

Basically the segue doesn't work. It says it couldn't find that Segue for this view controller. I have tried the same exact code for viewcontroller and the segue is found. The only difference is when I inherit from PTDSimpleCalendarViewController the segue is not found. If there is another way to do this please advise. Basically when a date is clicked I'd like to perform a segue.

//
// Calendar.h
// SuperMe
//
// Created by Saviz Artang on 9/18/15.
// Copyright (c) 2015 com.artangco. All rights reserved.
//

import "PDTSimpleCalendarViewController.h"

@interface CalendarViewController : PDTSimpleCalendarViewController

@Property (nonatomic, strong) NSDate * myselectedDate;

@EnD

//
// Calendar.m
// SuperMe
//
// Created by Saviz Artang on 9/18/15.
// Copyright (c) 2015 com.artangco. All rights reserved.
//

import "CalendarViewController.h"

import "SMTableViewController.h"

@implementation CalendarViewController

-(void) viewDidLoad
{
[super viewDidLoad];

self.delegate = self;

}

  • (void)simpleCalendarViewController:(PDTSimpleCalendarViewController *)controller didSelectDate:(NSDate *) date
    {
    self.myselectedDate = date;
    [self performSegueWithIdentifier:@"ctv" sender:self];
    }

  • (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    SMTableViewController * trackingTableView ;

    trackingTableView = [segue destinationViewController];
    trackingTableView.day = self.myselectedDate;
    }

@EnD

I found the same issue - it looks like it's something to do with PDTSimpleCalendarViewController's initWithCoder: not calling [super initWithCoder:].

I worked around this by calling self = [super initWithCoder:coder]; before self = [super initWithCollectionViewLayout:[[PDTSimpleCalendarViewFlowLayout alloc] init]]; - it really isn't a nice hack & I'm open to better ways around this issue!