2

I used a MBCalendarKit. This is an event shown on tableView method - (void)calendarView:(CKCalendarView *)CalendarView didSelectEvent:(CKCalendarEvent *)event. This method works same as - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath. I want to call the method didSelectEvent on tableView cell click event. How to move to another view controller on cell click ?and pass cell array data. How is it possible? Please help. Thank You

Method

- (void)calendarView:(CKCalendarView *)CalendarView didSelectEvent:(CKCalendarEvent *)event
{
 //  A row is selected in the events table. (Use to push a detail view or whatever.)
 CalendarViewController*destVC = [[CalendarViewController alloc] init];
destVC.pure=arr;
[self presentViewController:destVC animated:YES completion:nil];

}
Community
  • 1
  • 1
A.Kumawat
  • 103
  • 9

2 Answers2

0

In tableview didSelectRowAtIndexPath Method :-

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

call your function :-

[self didSelectEvent:..

Also to move to another view controller use segue as follows in same didSelectRowAtIndexPath Method of tableView:-

[self performSegueWithIdentifier:@"segueName" sender:self];

Finally, to pass cell array use prepareForSegue:-

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"segueName"])
    {

        DestViewController *dest = segue.destinationViewController;
        dest.passedArr = Arr;

    }
}

Note:- "segueName" needs to be defined in Storyboard

Janmenjaya
  • 4,149
  • 1
  • 23
  • 43
Meet
  • 1,196
  • 12
  • 26
0

If you’re implementing CKCalendarViewDelegate, or subclassing CKCalenderViewController, from inside calendarView:didSelectEvent:, you can push a new view controller onto the navigation stack, or present it yourself, with presentViewController:animated:completion:.

If you want to pass the event through to the second view controller, assign it as a property before presenting or pushing the view controller.

Disclosure: I’m the author of MBCalendarKit.

Moshe
  • 57,511
  • 78
  • 272
  • 425