I have defined a label in my viewController and I also set its @property and synthesized it. I have establish link between between file owner and UIlabel in viewDidLoad. I am trying to display this string link:
- (void)viewDidLoad {
getname = [[UILabel alloc] init];
getname.text = @"hello";
[super viewDidLoad];
}
But the string is not displaying on the label on the UIView. Please tell me what I need to do to display a string on a UIView. The view controller and nib file has the same names.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
But when I added viewcontroller.m file want to display something on view, it does not response to that code. How can I fix this?
Just replace this function this code
Hope it helps you..
Also if you are using IBOutlet in your .h file, don’t allocate memory to it as it automatically allocates memory.
So if you have used IBOutlet then your function should be