Make Background of UIView a Gradient Without Sub Classing

前端 未结 4 1608
庸人自扰
庸人自扰 2020-11-30 21:31

Is there a way to make the background of a UIView a gradient without subclassing it? I\'d rather not use an image file to accomplish this either. It just seems obtuse to hav

4条回答
  •  天命终不由人
    2020-11-30 21:59

    I agree with rpetrich, it would be cleaner to just do the UIView subclass. For an example of how to do this, see my response in this question. If you wanted, you could create a generic gradient UIView subclass and simply place that behind the views you want to have gradient backgrounds.

提交回复
热议问题