Skip to content

Instantly share code, notes, and snippets.

@edom18
Created February 7, 2014 00:46
Show Gist options
  • Save edom18/8855492 to your computer and use it in GitHub Desktop.
Save edom18/8855492 to your computer and use it in GitHub Desktop.
[iOS] CALayerが便利そう ref: http://qiita.com/edo_m18/items/56267b5108a79f2e1e5d
//レイヤーを新規作成
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, 120, 150);
sublayer.borderColor = [UIColor blackColor].CGColor;
sublayer.borderWidth = 2.0;
sublayer.cornerRadius = 10.0;
[self.view.layer addSublayer:sublayer];
//上記生成の後
sublayer.contents = (id)[UIImage imageNamed:@"hoge.jpg"].CGImage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment