【问题标题】:iphone/ipad - How can I draw an CGRect imageview in CALayer?iphone/ipad - 如何在 CALayer 中绘制 CGRect 图像视图?
【发布时间】:2012-02-08 16:00:02
【问题描述】:

我正在尝试在 CGRect 中从 ipad 相机捕获图像并将其添加到 CALayer 中,但它无法正常工作。它只显示蓝屏。

请任何人帮助我...

【问题讨论】:

    标签: iphone ipad ios5 calayer cgrect


    【解决方案1】:
    CALayer *sublayer = [CALayer layer];
    
    sublayer.backgroundColor = [UIColor blueColor].CGColor;
    
    sublayer.shadowOffset = CGSizeMake(0, 3);
    
    sublayer.shadowRadius = 5.0;
    
    sublayer.shadowColor = [UIColor blackColor].CGColor;
    
    sublayer.shadowOpacity = 0.8;
    
    sublayer.frame = CGRectMake(30, 30, 128, 192);
    
    sublayer.contents = (id) [UIImage imageNamed:@"BattleMapSplashScreen.jpg"].CGImage;
    
    [self.view.layer addSublayer:sublayer];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-08
      • 2011-06-26
      • 1970-01-01
      相关资源
      最近更新 更多