标签:
B类继承自A类,A类要扫描二维码,B类要上传图片,同时要调用imagePickerController这个方法。
在A类里:
- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
//扫描二维码也需要打开相机
}
在B类里:
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
if ([self.class isSubclassOfClass:[A class]]) {
//打开相册上传图片
} else {
//扫描二维码也需要打开相机 执行父类原来的方法
[super imagePickerController:picker didFinishPickingMediaWithInfo:info];
}
}
标签:
原文地址:http://www.cnblogs.com/huangzs/p/4501407.html