2014-12-05 23 views
0

我似乎無法得到這個權利。我看了幾篇教程並沒有運氣。我意識到這是一個簡單的任務,這就是爲什麼我很困惑爲什麼它不適合我。 我有一個擴展單元格內的程序化按鈕,當你按下它時,它是假設訪問相機拍照。我有這樣的代碼:在iOS應用拍照

- (void)buttonPressed:(UIButton *)button { 
    UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
    picker.sourceType = UIImagePickerControllerSourceTypeCamera; 
    [picker setDelegate:self]; 
    //picker.allowsImageEditing = NO; 
    [self presentModalExpandingCell:picker animated:YES]; 

    picker.showsCameraControls = YES; 
} 

出現錯誤在第5行,並說:「爲‘ExpandingCell’不可見的@interface聲明選擇‘presentModalExpandingCell:動畫:’」我有「」在.h文件中,以便我不知道該怎麼做。 任何幫助將不勝感激。提前致謝。

+0

檢查您的presentModalExpandingCell:動畫:方法 – gronzzz 2014-12-06 00:08:22

+0

我跟着一個教程,這就是它走向我。在教程中它說視圖控制器而不是擴展單元,除了我做了他們所做的一切。他們沒有爲該方法申報任何東西。 – Tstac4 2014-12-06 17:10:37

+0

可能有錯誤,而不是[self presentModalExpandingCell:picker animated:YES];使用這個 [self presentViewController:picker animated:YES completion:nil]; – gronzzz 2014-12-06 17:15:50

回答

0

您是否在類中聲明瞭「presentModalExpandingCell」方法?因爲,如果沒有,那就是編譯器拋出這個錯誤的原因。

+0

我跟着一個教程,這就是它走向我。在教程中它說視圖控制器而不是擴展單元,除了我做了他們所做的一切。他們沒有爲該方法申報任何東西。 – Tstac4 2014-12-06 17:03:24