문제

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