Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>UIView</code> has a <code>clearsContextBeforeDrawing</code> boolean property that switches between the different behaviors you describe. The default is YES which means the view empties the context before calling <code>drawRect:</code></p> <p>Check if that property is set somewhere in the example.</p> <p>Apparently a view doesn't clear it's context correctly, when no backgroundColor is set on the view. Please set backgroundColor to something other than nil.</p> <p>I think this is a bug and have filed <a href="http://openradar.appspot.com/radar?id=444404" rel="nofollow noreferrer">rdar://8165730</a>.</p> <hr> <p>EDIT</p> <p>It's not a bug. You have to set the opaque property to NO or the backgroundColor. The behavior is described in the UIView Documentation.</p> <p>Property <code>clearsContextBeforeDrawing</code>:</p> <blockquote> <p>The default value of this property is YES. When set to YES, the current graphics context buffer in the drawRect: method is automatically cleared to transparent black before drawRect: is invoked. If the view’s opaque property is also set to YES, the backgroundColor property of the view must not be nil or drawing errors may occur.</p> <p>If the value of this property is NO, it is the view’s responsibility to completely fill its content. Drawing performance can be improved if this property is NO—for example, when scrolling.</p> </blockquote> <p>Property <code>opaque</code>:</p> <blockquote> <p>YES if it is opaque; otherwise, NO. If opaque, the drawing operation assumes that the view fills its bounds and can draw more efficiently. The results are unpredictable if opaque and the view doesn’t fill its bounds. Set this property to NO if the view is fully or partially transparent. The default value is YES.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload