Skip to content
Turns static PaintCode or Qwarkee code into a UIView that honors the contentMode property
Objective-C Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Turns static PaintCode or Qwarkee code into a UIView that honors its contentMode property.




pod "MMScalableVectorView"


Just import MMScalableVectorView.m & .h into your project directly.


  • iOS 4.x or higher
  • CoreGraphics framework
  • ARC


Using MMScalableVectorView Directly

  1. Use - (id)initWithFrame:(CGRect)frame drawingBlock:(void (^)(void))drawingBlock originalSize:(CGSize)originalSize to create a new instance of MMScalableVectorView, providing the vector drawing block and original size.
  2. Set the object's contentMode as desired.
  3. Add the view to a view hierarchy or draw it manually using - (void)drawInFrame:(CGRect)frame.


  1. Create a new class to represent the graphic, and make sure it inherits from MMScalableVectorView.
  2. Implement the following methods:
    1. Paste the Qwarkee/PaintCode drawing code into drawInCurrentContext
    2. Implement originalSize to return a CGSize structure for the native size of the vector graphic.
  3. Use the newly created class as a normal UIView, setting the contentMode property as desired before the view is drawn. This can be done in Interface Builder or programatically.


Run pod install inside the Demo folder, then load the Demo workspace & run!

Future Improvements

  1. UIView category with a block-based initializer for one-step creation of vector-backed UIViews.
  2. Improving drawing when UIView’s transform property is used (?)
  3. Unit tests!
You can’t perform that action at this time.