2014-09-03 2 views
2

안녕 난한다는 점에서 구글 맵을 사용하고 내가 코드 이미지 아래에 marker i wantIOS 구글 맵 사용자 정의 마커

내가했던 것처럼 마커를 사용하려는

UIView *markerview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 55, 102)]; 
markerview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"glow-marker2.png"]]; 
UIImageView *imgview = [[UIImageView alloc] initWithFrame:CGRectMake(4, 4, 47, 70)]; 
imgview.backgroundColor = [UIColor whiteColor]; 
imgview.contentMode = UIViewContentModeScaleAspectFit; 
imgview.image = img; 
imgview.layer.cornerRadius = 7; 
imgview.layer.masksToBounds = YES; 
[markerview addSubview:imgview]; 
marker.icon = [self imageWithView:markerview]; 
marker.map = mapview; 

가주고 나 출력

getting output

아무도 왜이 검은 배경이 오는지 말해 줄 수 있습니까? 어떻게 해결할 수 있을까요?

답변

0

나는이 문제가 귀하의보기 배경으로 설정되어 있다고 생각합니다.

markerview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"glow-marker2.png"]]; 

나는 명확한 색상과 같은 해당 뷰의 배경을 만들기 위해 제안하고 opaque=NO을 설정하고 이미지 뷰에 이미지를 설정하고 markerview

의 당신이 해결 될 것 교부 희망 서브 뷰이 이미지를 추가 .

0

저는 UIView를 이미지로 만들 때 문제가 있다고 생각합니다. 아래 코드를 시도하십시오

- (UIImage *) imageWithView:(UIView *)view 
{ 
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 1.0); 
    [view.layer renderInContext:UIGraphicsGetCurrentContext()]; 

    UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); 

    UIGraphicsEndImageContext(); 

    return img; 
}