iPad アプリで作業していますが、デリゲートに問題があります... プロトコル メソッドが呼び出されません。何が欠けているのかわからない、これが私のコードです。
@protocol pickerLabelProtocol <NSObject>
- (void)selectedPickerData:(UILabel *)sender;
@end
@interface showPickerVC : UIViewController
@property (nonatomic, strong) id <pickerLabelProtocol> delegate;
@end
@implementation showPickerVC
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
//i used breakpoint, the 'delegate' is always nil for some reason?
[self.delegate selectedPickerData:self.mainLabel];
}
----------------------
@interface someViewController : UIViewController <pickerLabelProtocol>
@property (nonatomic, strong) showPickerVC *showPicker;
@end
@implementation someViewController
- (void)selectedPickerData:(UILabel *)sender
{
//protocol method
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.showPicker = [[showPickerVC alloc]init];
self.showPicker.delegate = self;
}