为什么UIBezierPath的角落是透明的?

时间:2015-08-14 10:02:26

标签: ios xcode swift uibezierpath

我想用角半径制作我的TopLeft和TopRight角。它适用于此代码:

def reset_password!(new_password, new_password_confirmation)
  self.password = new_password
  self.password_confirmation = new_password_confirmation

  validates_presence_of     :password
  validates_confirmation_of :password
  validates_length_of       :password, within: Devise.password_length, allow_blank: true

  if errors.empty?
    clear_reset_password_token
    after_password_reset
    save(validate: false)
  end
end

但它使角落透明,如下所示:

enter image description here

如何让它们可见?

1 个答案:

答案 0 :(得分:1)

Bcs它只是一个面具,你的图层仍然是正方形。有很多方法可以做到这一点,例如,您可以绘制自己的图层并将其添加为子图层。这个属性可以帮助你:

layer.fillColor = LAYER_COLOR.CGColor;
layer.strokeColor = LAYER_BORDER_COLOR.CGColor;
layer.lineWidth = LAYER_BORDER_WIDTH;
layer.opacity = LAYER_OPACITY;