I have Class A which contains a xib with some buttons and a UITextField and Class B which contains a tableView
I want to add Class A to the table view header.
I am importing the xib from class A into class B using [[[NSBundle mainBundle] loadNibName: owner:self options:nil] objectAtIndex:0];
I just want to reflect the button and textview actions inside classB. In ClassB I do have some UITextfield Delegate methods which i expect to be called when typing some text in uitextfield defined and declared in ClassA (xib + property definition in .h file).
Class A .h:
//properties are set from xib file ClassA.xib
@interface ClassA : UIView
@property (unsafe_unretained, nonatomic) IBOutlet UIButton *addC;
@property(strong, nonatomic) IBOutlet UITextField *nText;
@end
Class B.h
#import "ClassA"
@interface ClassB : UIViewController <UITextFieldDelegate, UITableViewDataSource,...>
@property (strong, nonatomic) IBOutlet UITableView *mTableView; //property set from ClassB.xib
@property(strong, nonatomic) IBOutlet UITextField *nText_B;
@property (unsafe_unretained, nonatomic) IBOutlet UIButton *addC_B;
- (IBAction)addC:(UIButton *)sender;
@end
I don't know how to make the link ClassB button and textfield to ClassA
In ClassB viewDidLoad
method i;ve tried this:
getHeader = [[ClassA alloc]init];
_addC_B = [getHeader addC];
_nText_B = [getHeader nText];
_nText_B.delegate =self;
_nText_B.text=@"";
but it's not working
I am new to iOS on this side area.
Thank you for your help