在我的应用程序中,我试图将数据从父视图传递到子视图。但是,当我运行应用程序时,不会调用委托方法。这是我如何实现自定义委托的代码:parent.h
@protocol SLBWallViewControllerDelegate <NSObject>
- (void) pictureToBeUploaded:(id)picture;
@end
@interface SLBWallViewController : UIViewController <UIActionSheetDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate>
- (IBAction)createPotButtonPressed:(id)sender;
@property (weak, nonatomic) id <SLBWallViewControllerDelegate> delegate;
@end
父母.m
[self.delegate pictureToBeUploaded:info[UIImagePickerControllerEditedImage]];//i'm taking the pic from a uiimagepicker
孩子.h
@interface SLBPostViewController : UIViewController <SLBWallViewControllerDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *picture;
@end
孩子.m
#pragma mark - Wall View Controller Delegate
- (void)pictureToBeUploaded:(id)picture{
self.picture.image = picture;
}
有什么错误或遗漏吗?