在我的iPhone應用程序......Proble調用自定義委託方法
無法調用委託方法....
這裏是我的代碼
我創建了一個簡單的委託在一個類中...
@protocol imagecelldelegate
-(BOOL) isIntersects:(CGRect)lastTouch;
@end
@interface ImageDemoGridViewCell : AQGridViewCell
{
id<imagecelldelegate> delegate;
}
@property (nonatomic,retain) id delegate;
@end
現在我已經在這個類的實現中設置了委託並調用委託方法。
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[self setDelegate:self.superview];
[delegate isIntersects:originalSelf];
//Getting error at this point...
}
後,我已經實現了我在其中設置了委託類中的方法..
@interface ViewController : UIViewController<imagecelldelegate>
{
和實施這個類中的方法....
-(BOOL) isIntersects:(CGRect)lastTouch
{
NSLog(@"Delegate Yippee");
return YES;
}
您是否收到任何錯誤?或「代表Yippee」未記錄? – 2012-01-06 05:39:53
當我打電話給那條線的方法得到錯誤.. – 2012-01-06 05:42:12