2012-01-18 18 views
0

iPhoneアプリケーションでは、半曲線の形で画面全体に画像を表示したいと考えています。 画像はコーナーから始まり、別のコーナーに触れることで終了します。私は誰も私を助けてくださいこれをするためのアイデアを持っていない。 この画像テーブルは半湾曲しているが、画像が画像をビューに半円形の形で表示したい

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

+0

あなたはあなたのUIViewは、半湾曲させたいわけ?なぜアルファを使用しないのですか? –

+0

アルファを使用すると半曲線に見えません。 – shivangi

答えて

0

半湾曲した形状で表示されるべきcurvicalする画像を変更、または画像で遊んでのCALayerを用いて達成することができます。すべての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にインポートしましたか? –

関連する問題