Установите высоту UIView в зависимости от размера экрана
У меня есть UIView под столом. Я должен установить высоту UIView для iPhone 4S или 5. Я пытался использовать
- (void) regolaViewPeriPhone {
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.height == 480)
{
CGRect frame = CGRectMake(0, 210, 320, 245);
_pickerContainerView.frame = frame;
}
if(result.height == 568)
{
CGRect frame = CGRectMake(0, 210, 320, 290);
_pickerContainerView.frame = frame;
}
}
}
но это не работает, какой правильный метод? Спасибо!
2 ответа
Решение
Это способ "Установить высоту UIView в зависимости от размера экрана"
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568)
{
//Do u r stuff here for Iphone 5
}
else if(screenBounds.size.height==480)
{
//Do u r stuff here for Iphone 4s
}
// если мой ответ правильный, проголосуй за меня...