我有一個按鈕調用一個方法的選擇器,但我收到一個錯誤!無法識別的選擇器發送到實例PDF顯示方法
我在.H
- (void)pdfPressed
設置的方法,然後用它的.m
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"paper-plane-7.png"] style:UIBarButtonItemStylePlain target:(DNavigationController *)self.navigationController action:@selector(pdfPressed)];
- (void)pdfPressed {
//...
但是我得到這個錯誤。
- [DNavigationController pdfPressed]:當你創建你指定的目標和選擇按鈕無法識別的選擇發送到實例0x144e0fe60
。 目標只是您的對象,選擇器指定在目標上調用哪個方法。在你的例子中,你將導航控制器設置爲目標,所以當你點擊按鈕時,你的導航控制器會嘗試調用不存在的pdfPressed方法,你會得到崩潰 – 2015-03-19 07:48:58