respondsToSelector的使用

-(BOOL) respondsToSelector: selector 用来判断是否有以某个名字命名的方法(被封装在一个selector的对象里传递)

@protocol ShareFileUploadDelegate <NSObject>
- (void) didFinishUpload:(ShareFileUpload*)obj;
@end

 

if ([delegate respondsToSelector:@selector(didFinishUpload:)]) {
  [delegate didFinishUpload:self];
}

 

#pragma mark -
#pragma FileUploadDelegate
- (void) didFinishUpload:(ShareFileUpload*)obj
{
    [self setModalViewPrompt:NSLocalizedString(@"UploadSuccess", nil)];
    [self performSelector:@selector(showModalView:) withObject:[NSNumber numberWithBool:NO]   afterDelay:1.5];
    [self clear];
    SAFE_RELEASE(obj);
}

posted @ 2012-08-14 11:03  _安静ゝ  阅读(9225)  评论(0编辑  收藏  举报