2012-01-18 4 views
0

iPhone 응용 프로그램에 이미지를 전체 화면으로 표시하고 싶지만 세미 커브 모양으로 표시하고 싶습니다. 이미지가 코너에서부터 시작해서 다른 코너를 만지면 끝납니다. 나는 이것을 도와 줄 누군가가 나를 기쁘게 할 수있는 아이디어가 없다. 이 이미지 테이블 세미 곡선이지만 curvical 이미지 또는 이미지의 CALayer 재생 방법을 이용하여 달성 될 수있는 것으로 변경 이미지 반 곡선 형상보기에 이미지를 반원 모양으로 표시하고 싶습니다.

This image table is semi curved but image should be displayed on semi curved shape

+0

당신이 당신의 UIView는 곡선 반되고 싶어? 알파를 사용하지 않는 이유는 무엇입니까? –

+0

알파를 사용하면 반 커브가되지 않습니다 .. – shivangi

답변

0

에 표시한다. 모든 imageView에는 레이어가 있습니다. 효과를 나타낼 때 사용하십시오. 당신이 당신의 테이블 이미지를 원 효과는이 코드를 통해 acheived 할 수 있습니다 : -

-(void) viewDidLoad{ 

    [self paperCurlShadowImage]; 
} 

-(void) paperCurlShadowImage{ 

     imgView = [[UIImageView alloc] initWithImage:image]; 
     imgView.frame=CGRectMake(0, 0, image.size.width, image.size.height); 


     [self.view addSubview:imgView]; 

     imgView.layer.shadowColor = [UIColor blackColor].CGColor; 
     imgView.layer.shadowOpacity = 0.7f; 
     imgView.layer.shadowOffset = CGSizeMake(10.0f, 10.0f); 
     imgView.layer.shadowRadius = 2.0f; 
     imgView.layer.masksToBounds = NO; 


     imgView.layer.shadowPath = [self renderPaperCurl:imgView]; 
     [imgView release]; 

} 당신은 의미

- (CGPathRef)renderPaperCurl:(UIView*)imgView1 { 
    CGSize size = imgView1.bounds.size; 
    CGFloat curlFactor = 15.0f; 
    CGFloat shadowDepth = 5.0f; 

    UIBezierPath *path = [UIBezierPath bezierPath]; 
    [path moveToPoint:CGPointMake(0.0f, 0.0f)]; 
    [path addLineToPoint:CGPointMake(size.width, 0.0f)]; 
    [path addLineToPoint:CGPointMake(size.width, size.height + shadowDepth)]; 
    [path addCurveToPoint:CGPointMake(0.0f, size.height + shadowDepth) 
      controlPoint1:CGPointMake(size.width - curlFactor, size.height + shadowDepth - curlFactor) 
      controlPoint2:CGPointMake(curlFactor, size.height + shadowDepth - curlFactor)]; 

    return path.CGPath; 
} 
+0

imgView.layer.shadowColor = [UIColor blackColor] .CGColor; \t imgView.layer.shadowOpacity = 0.7f; \t imgView.layer.shadowOffset = CGSizeMake (10.0f, 10.0f); \t imgView.layer.shadowRadius = 2.0f; \t imgView.layer.masksToBounds = NO; \t \t \t imgView.layer.shadowPath = [self renderPaperCurl : imgView]; – shivangi

+0

이 라인은 "이름이 다른 모든 라인에 대해 같은 속성의 알 수없는 shadowColor 컴포넌트에 액세스 중입니다. 도와주세요. – shivangi

+0

QuartzCore, CoreGraphics를 프로젝트의 프레임 워크로 가져 왔습니까? –

관련 문제