Вопрос

By default, progressBar have a different height in Ios7 and Ios6.

to set the height of my progressBar I use the following code :

CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 2.0f);
self.myProgressbar.transform = transform;

but it's only work on ios6. in ios7, the progressBar still have the default height.

How can I set the same height for both ios 6 and 7 ?

thanks for your help.

Это было полезно?

Решение 2

code that work's for me, thanks for help

- (BOOL)isDeviceVersion:(NSString *)version
{
    return ([[[UIDevice currentDevice] systemVersion] compare:version  options:NSNumericSearch] == NSOrderedSame);
}


-(void) viewWillLayoutSubviews
{
    if ([self isDeviceVersion:@"7.0"])
    {
        CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 25.0f);
        self.myProgressbar.transform = transform;
    }else{
        CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 2.0f);
        self.myProgressbar.transform = transform;
    }

}

Другие советы

Applying transform to a view works fine in both iOS6 and iOS7. So that is not the issue. In iOS6 height of the progress bar is 9.0 and in iOS7 it is 2.0. So in order to have the height same in both the OS versions, use the below code

- (BOOL)isDeviceVersion:(NSString *)version
{
    return ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedSame);
}

if ([self isDeviceVersion:@"7.0"])
{
    CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 4.5f);
    self.myProgressbar.transform = transform;
}

y transform 4.5 because 9.0 = 2.0 * 4.5

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top