I am new to iPhone development. I am creating an application in which i need to create buttons and labels programmatically.
So I am doing this in .h file
Since you alloced memory, you need to release it as well. Anytime you use alloc, copy or new, remember to always release. Its not a good idea to release everything only at dealloc. Release objects when you are done with them. For example:
setchallange = [[NSString alloc] initWithFormat:@"%@" , challange];//Memory leak here
Challengetext.text = setchallange;
[setchallange release]
Also checkout out the iOS memory management guide. I'm sure it will help.