備註:代理協議寫法 、block

.h文件

1.

@protocol CYGHDocListDelegate

- (void)GHDocName:(SCGetDoctorsDataResponseModel *)_doc andNum:(NSString *)num;

@end


@property (weak,nonatomic)id delegate;

2.

@protocol CGConsigneeInfoViewControllerDelegate


@optional


- (void)CGConsigneeInfo:(SelectAddress *)info;


@end


.m文件

if (_delegate &&[_delegate respondsToSelector:@selector(CGConsigneeInfo:)]) {

                [_delegate CGConsigneeInfo:self.selectInfoData];

            }


二、

typedef void(^patientInfoSelected)(NSString *relationship,NSString *sex,NSString *age , NSString *patientId,NSString *name,NSString *idCard);


@property (nonatomic,copy)patientInfoSelected patientInfoSelectedBlock;


if(self.patientInfoSelectedBlock != nil){

                        

                        self.patientInfoSelectedBlock(defaultModel.RELATIONSHIP,defaultModel.SEX,defaultModel.AGE,defaultModel.ID,defaultModel.REAL_NAME,defaultModel.IDCARD_NO);

 }



block回調函數

patient.patientInfoSelectedBlock= ^(NSString *relationship,NSString *sex,NSString *age , NSString *patientId,NSString *nameString,NSString *idCardString){

            

            NSLog(@"%@ %@ %@ %@",relationship,sex,age,patientId); 

        };



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章