I created my UI elements programmatically in ios. Everything is fine in all iphone sices but my buttons get streched.
btnLogin=[[UIButton alloc] initWithFrame:CGRectMake(80, h-90, w-160, 40)];
This is the way Icreated my button. I know In interface builder we can use auto layout. But how can I add constraints to this button programmatically?
Because now the button width changing according to the screen size although the left and right side edges are fixed. How can I avoide the element streatching according to the device and also I want to manage the same gap between left and right side between the button and the parent view border.
How can I do this? Please help me Thanks