- (CGSize)getSizeWithHeight:(CGFloat)height width:(CGFloat)width
{
CGSize size = {0,0};
CGFloat fHeight = [UIScreen mainScreen].bounds.size.height;
CGFloat fWidth = [UIScreen mainScreen].bounds.size.width;
if (height < fHeight && width < fWidth)
{
size.height = height;
size.width = width;
}
else
{
if (height >= fHeight && width <= fWidth)
{
CGFloat mult = fHeight/height;
size.height = fHeight;
size.width = width*mult;
}
else if (height <= fHeight && width >= fWidth)
{
CGFloat mult = fWidth/width;
size.height = height*mult;
size.width = fWidth;
}
else if (height >= fHeight && width >= fWidth)
{
CGFloat multW = fWidth/width;
CGFloat multH = fHeight/height;
if (multW <= multH)
{
size.height = height*multW;
size.width = fWidth;
}
else
{
size.width = width*multH;
size.height = fHeight;
}
}
}
return size;
}