lundi 1 décembre 2014

Programmatically create an object under different screen sizes

I am having the code below for creating an button.

Now the location of the button cannot be aligned or scaled correctly with different devices.


I wrote the following code under iPhone 6 screen size.



UIButton *but= [UIButton buttonWithType:UIButtonTypeRoundedRect];
[but addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[but setFrame:CGRectMake(605, 320, 35, 35)];
[but setTitle:@"Login" forState:UIControlStateNormal];
[but setExclusiveTouch:YES];
[self.view addSubview:but];


If i want to have the same position for iPhone 6 plus as the iPhone 6. What can i do?


Many thanks.




Aucun commentaire:

Enregistrer un commentaire