LoginSignup
5
5

More than 5 years have passed since last update.

[objc][memo] さっくと、四角いUIView 丸いUIViewを作る。

Last updated at Posted at 2014-03-29

サクッとUIView作って表示確認したいとき


//------------------------------
// 四角のUIView
//------------------------------
UIView * square = [[UIView alloc] initWithFrame:CGRectMake(35,55,10,10)];
square.backgroundColor = [UIColor blueColor] ;
[self.view addSubview:square];


//------------------------------
// 円のUIView
//------------------------------
float r = 12.0f;
float x = 5.0f;
float y = 5.0f;
UIView *circle = [[UIView alloc] initWithFrame:CGRectMake(x,y,r,r)];
circle.alpha = 0.5;
circle.layer.cornerRadius = r*0.5;
circle.backgroundColor = [UIColor blueColor];
[self.view addSubview:circle];

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5