In your code,
lbl1.delegate=self;
If delegate should represent class other than ITSELF, THAN its value is wrong. It should be set to some other delegate class:
lbl1.delegate = _delegateClass;
Here: _delegateClass
represents some other class than itself.
for example: (psuedocode)
.h File:
@interface ViewController1 : UIViewController
@end
.m file:
@interface ViewController1 ()
@end
@implementation ViewController1
- (void)viewDidLoad
{
// initialize view controller here
// set _delegate to self
}
@end
.h File:
@interface ViewController2 : UIViewController
{
// declare textfield here
}
@property id _delegate;
@end
.m file:
@interface ViewController2 ()
@end
@implementation ViewController2
@synthesize _delegate
...
... // Here set : textfield.delegate = _delegate; // now it refers to viewController1 and all event of textfield will be handle in ViewController1
...
@end
I tried to be descriptive/ in detail as much a I can now.
Happy Coding!!