get NSDate into titleForHeaderInSection from another ViewController

前端 未结 1 1864
时光说笑
时光说笑 2021-01-26 23:06

I have two views, first one is with calendar and the second one is a UIView with a tableView; I\'m trying to display the selected date from the firstView. Managed

1条回答
  •  隐瞒了意图╮
    2021-01-26 23:22

    Declare an @property (nonatomic, retain) NSDate *displayDate; (or strong instead of retain when using ARC) on your TableViewController (dont forget to synthesize). The first view can then set the property of the TableViewController, for example:

    MyTableViewController *mtvc = [[MyTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
    mtvc.displayDate = selectedDate;
    ...
    

    You can then access the date from within your TableViewController using self.displayDate, for example in your titleForHeaderInSection.

    0 讨论(0)
提交回复
热议问题