UIView 和 CALayer

來源:互聯網
上載者:User

標籤:uiview calayer



    UIView 負責互動 和 frame 以及顯示CALayer
    CALayer 負責渲染, 是UIView的一個readonly 屬性
    
     用來設定圓角 參數是內切圓的半徑 ,如果想畫一個圓的話,view必須是正方形 . 參數應該是view邊長的一半
    self.changeView.layer.cornerRadius = 50;
    
     描邊的寬度
     self.changeView.layer.borderWidth = 5;
    
     描邊的顏色 (UIView 上的顏色 使用的是UIColor CALayer上的顏色使用的是CGColor )
    self.changeView.layer.borderColor = [UIColor greenColor].CGColor ;
    
     陰影的不透明度 取值範圍[0,1], 預設是0 (透明)
    self.changeView.layer.shadowOpacity = 0.5;
    

    陰影的顏色
    self.changeView.layer.shadowColor = [UIColor greenColor].CGColor;
    
     陰影的位移量
     width  影響水平位移 (正右負左)
    height 影響垂直位移 (正下負上)
    self.changeView.layer.shadowOffset = CGSizeMake(10, 5);
    
    
    
     CAAnimation 是一個抽象類別 ,使用必須子類化 ,
    
    CAPropertyAnimation 是一個抽象子類 也是同樣子類化


UIView 和 CALayer

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.