3
目前我已在我的tabBarViewControllers
之一中實施了Kal日曆,並且佈局非常完美。我現在想要創建一個用戶點擊的按鈕,並且日曆會立即在每月日曆視圖中按鈕「今日」突出顯示當前日期。使用Kal日曆
佈局再次完美,但下面列出的最後一行代碼給出了問題。
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SecondViewController showAndSelectToday]: unrecognized selector sent to instance 0x927e6f0'
這裏是我已經對我secondViewController
類是UIViewController
一個超所作的落實。
- (void)viewDidLoad { KalViewController *calendar = [[KalViewController alloc] init]; [self.view addSubview:calendar.view]; [self addChildViewController:calendar]; [[self navigationController] initWithRootViewController:calendar]; calendar.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Today" style:UIBarButtonItemStyleBordered target:self action:@selector(showAndSelectToday)]; }
目標:給「今日」功能不通過應用程序委託,但一個獨立的類,像我secondViewController
。
注意:假日示例應用程序正是我想要的「今日」行爲,但假日示例項目實現了應用程序委託中的今日按鈕行爲。