2012-03-02 28 views
-1

我一直在使用xcode 4幾個月,現在沒有問題,但有一些問題,但這是另一回事,現在有一個奇怪的問題。我不能添加任何新的方法...我的意思是說,當我添加一個新的方法xcode不認識它。該標籤後面沒有看到它,調試器錯誤表示沒有該名稱的方法。然而,它上面的方法與名稱完全相同的方法減去名稱是着名的。XCode 4不會讓我添加新方法

有沒有人見過這個?如果可以的話,請你讓我朝正確的方向發展。任何幫助,我都會永遠感激。

- (void)showMyCalendar:(TKCalendarMonthView*) calendar1 
{ 
     if (calendar1.frame.origin.y == -calendar1.frame.size.height+calendarShadowOffset) 
    { 
     [self displayCalendar:calendar1]; 
    } 
    else 
    { 
     [self hideCalendar:calendar1]; 
    } 
    [self showMyCalendar:calendar1]; // If I put a call here xcode sees it. 
} 


- (void)anotherMethod:(TKCalendarMonthView*) calendar1 
{ 
     if (calendar1.frame.origin.y == -calendar1.frame.size.height+calendarShadowOffset) 
    { 
     [self displayCalendar:calendar1]; 
    } 
    else 
    { 
     [self hideCalendar:calendar1]; 
    } 
    [self showMyCalendar:calendar1]; // If I put a call here xcode DOES NOT see it. 
} 

感謝, 埃德

+1

您可以發表您的代碼位請 – 2012-03-02 17:02:41

+0

請提供您的方法聲明以及實施。謝謝。 – Jeremy 2012-03-02 17:04:26

+0

好的,更多的是這個問題......也許我只是不熟悉Objective C ...我通過[self-method-name]調用它,並且在方法本身中它看到它,但在另一個方法中它不。很可能有一個簡單的解釋,但我肯定是在黑暗中。請指教。 – Edd 2012-03-02 17:08:55

回答

1

是否包含此方法包含在在.m文件的.h文件中的方法定義?

- (void)anotherMethod:(TKCalendarMonthView*) calendar1; 
+0

行了!如果在同一個文件中,我不認爲你必須這樣做。傑里米實際上也早一點回答了這個問題。 – Edd 2012-03-02 17:33:31

+0

只要它們在同一個文件中,您實際上不必這麼做...... **如果**您在Xcode 4.3中使用LLVM編譯器。新功能。 – 2012-03-02 17:42:27

+0

嗯,Xcode 4.3。我正在使用4.2。也許升級是爲了。非常感謝大家的幫助。 – Edd 2012-03-02 17:46:21