Q:

setNeedsDisplay doesn't work on subclass of UIImageView

import UIKit
class CustomView: UIView {
    override func drawRect(rect: CGRect) {
        print("Draw")
    }
}

Drag a UIView, set its class to be CustomView, create a reference customView to it.
When I call customView.setNeedsDisplay(), drawRect of CustomView get called.
import UIKit
class CustomImageView: UIImageView {
    override func drawRect(rect: CGRect) {
        print("DrawImage")
    }
}

Drag a UIImageView, set its class to be CustomImageView, create a reference customImageView to it.
When I call customImageView.setNeedsdisplay(), nothing happen. Why?

A:

The UIImageView class is optimized to draw its images to the display. UIImageView does not call the drawRect: method of its subclasses. If your subclass needs to include custom drawing code, you should subclass the UIView class instead.

