目前我已经在其中一个中实现了 Kal 日历,tabBarViewControllers并且布局非常完美。我现在想创建一个用户单击的按钮,日历会立即在月历视图中突出显示当前日期,即“今天”按钮。
布局再次完美,但下面列出的最后一行代码出现了问题。
*** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[SecondViewController showAndSelectToday]:无法识别的选择器发送到实例 0x927e6f0”
这是我对我secondViewController的类所做的所有实现,它是UIViewController.
- (void)viewDidLoad
{
KalViewController *calendar = [[KalViewController alloc] init];
[self.view addSubview:calendar.view];
[自我addChildViewController:日历];
[[self navigationController] initWithRootViewController:calendar];
calendar.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Today" style:UIBarButtonItemStyleBordered target:self action:@selector(showAndSelectToday)];
}
目标:不通过 APP DELEGATE 提供“今天”功能,而是通过单独的课程,比如我的secondViewController.
注意:假日示例应用程序正是我希望“今天”的行为,但假日示例项目在应用程序委托中实现了今天的按钮行为。