Pages

Labels

Tuesday, June 19, 2012

UIView programmatically with rounded corners


  • // don't forget to import quartz core
      

  • #import <QuartzCore/QuartzCore.h>  

  •   

  • // setting up size and position of the UIView  

  • int leftBorder = 20;  

  • int topBorder = 35;  

  • int width = 150;  

  • int height = 160;  

  •   

  • // creating new view  

  • UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(leftBorder, topBorder, width, height)];  

  •   

  • // setting up rounded corners  

  • myView.layer.cornerRadius = 10;  

  •   

  • // setting color for our view  

  • myView.backgroundColor = [UIColor redColor];  

  •   

  • // adding our new view on the  

  • [self.view addSubview:myView];  
  • 0 comments:

    Post a Comment

     
    Loading