I'm trying to get text from a UItextField
thats in a custom cell. I tried creating a protocol
@class customCellClass
@protocol CustomCellDelegate
-(void)passText:(CustomCell *)customCell withText:(NSString *)text;
@end
...
@interface
@property (nonatomic, weak) id<CustomCellDelegate> delegate;
@end
@interface MainCV<CustomCellDelegate>
@end
@implementation MainVC
@end
- (void)viewDidLoad {
CustomCell *cell = ... allocation and initialization
cell.delegate = self;
}
-(void)passText:(CustomCell *)customCell withText:(NSString *)text
{
}
- (void)viewDidLoad {
CustomCell *cell = [[customCellClass alloc] init];
cell.delegate = self;
}
In another method I want to do like this:
[self.delegate passText:self withText:self.myTextField.text];
But it doesn't let me do the last thing: [self.delegate passText...
.
Can someone please explain why it didn't work, and help me figure out a working way to get the textFields text.