2014-09-07 7 views
0

iOS 7 및 6을 지원해야하는 iOS 응용 프로그램을 개발 중입니다. iOS 7에서는 잘 작동하지만 iOS 6에서는 정말 이상한 버그가 발생합니다.왜곡 된 이미지가 iOS 6에서만 볼 수 있습니다.

거의 모든보기의 맨 위에 왜곡 된 이미지가 나타납니다. 물론,이 위치의 뷰 계층 구조에 이러한 이미지를 추가하지 않았습니다. 이미지는 실제로 내 스토리 보드에서 사용되는 아이콘입니다.

다음 스크린 샷이 iOS 6 시뮬레이터에서 나온 경우에도 UI가 iOS 7처럼 보일 수 있습니다. iOS7Kit을 사용하고 있기 때문입니다. 나는 그것을 사용하지 않으려 고 노력했다. 개미는 문제의 원인이 아니다.

실제 iOS 6 장치에도 문제가 발생하므로 시뮬레이터의 버그는 아닙니다.

나는이 버그를 해결하기 위해 무엇을 찾아야할지 모르겠다. 어떤 생각? 이 경우

은 왜곡 된 이미지 메뉴에서 온다 : 내 스토리 보드 메뉴보기의

Distorted image at the top of the gallery view.

스크린 샷 (당신이 볼 수있는 컨테이너보기 사용) :

Storyboard menu view!

Storyboard settings view

답변

0

: 내 스토리 보드 설정

Distorted image at the top of the settings view

스크린 샷보기 (또한 컨테이너보기 사용) : 설정에

는 설정 자체를 볼에서 왜곡 된 이미지가 온다보기 마침내 왜곡 된 이미지가 단지 "선택된"색상을 얻기 위해 프로그래밍으로 색조를 바꾼 이미지라는 것을 알았을 때 문제가 발견되었습니다. 나는 다음과 같은 기능을 사용하고 있었다

(에서 내가 잘 기억한다면 SO 대답) :

- (UIImage *)colorImageWithColor:(UIColor *)color 
{ 
    // Make a rectangle the size of the image 
    CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height); 
    // Create a new bitmap context based on the current image's size and scale, that has opacity 
    UIGraphicsBeginImageContextWithOptions(self.size, NO, self.scale); 
    // Get a reference to the current context (which we just created) 
    CGContextRef context = UIGraphicsGetCurrentContext(); 
    // Draw the image into the context we created 
    [self drawInRect:rect]; 
    // Set the fill color of the context 
    CGContextSetFillColorWithColor(context, [color CGColor]); 
    // This sets the blend mode, which is not super helpful. Basically it uses your fill color with the alpha of the image and vice versa. 
    CGContextSetBlendMode(context, kCGBlendModeSourceAtop); 
    // Now apply the color and blend mode onto the context. 
    CGContextFillRect(context, rect); 
    // Grab the result of all this drawing from the context. 
    UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); 
    // Destroy the bitmap context 
    UIGraphicsEndImageContext(); 
    return result; 
} 

UIGraphicsEndImageContext(); 호출이 누락되었습니다. 함수를 반환하기 전에이를 추가하면 문제가 해결됩니다.