我需要在iOS應用程序中使用委託對象。我已經宣佈委託作爲本:如何在iOS 5中使用代理
在培訓班裏的函數定義:
@interface OOObjectCommandInterface : NSObject<OOCameraControllerDelegate>
在所在班級的功能必須invoqued: (在德.h文件中)
@protocol OOCameraControllerDelegate
- (void)drawFrame:(CVImageBufferRef) imageBuffer:(BOOL)flip;
@end
和
@interface OOCameraController : UIViewController
{
...
id<OOCameraControllerDelegate> delegate;
}
@property (nonatomic, readwrite) id<OOCameraControllerDelegate> delegate;
的方法,另外,其中,第二類是初始化:
_hardwareController.delegate = [OOObjectCommandInterface ocInterface];
其中_hardwareController
是OOCameraController
類的一個實例。 所以,當我嘗試invoque委託對象,我這樣做:
[delegate drawFrame:imageBuffer:flip];
,但不會執行該功能。任何想法?
P.D .:我打電話的函數是一個單例類。那裏可能有問題嗎?
您是對的...¬¬ – goe 2012-07-16 11:21:56