Reputation: 12061
I am trying to move a swift file that I exported from PaintCode 2 into my project. I did the following.
Now I am looking a white box:
Now the file I got from PaintCode was of type NSObject which I knew couldn't be right so I changed it to UImage. Still getting the same result.
---------UPDATE-----------
I created a new Cococa Class of type UIView, and did the following:
@IBDesignable
class CareerButtonClass: UIView {
//CareerButton.drawCanvas2()
func drawCareerButton() {
CareerButton.drawCanvas2()
}
}
Then I named the custom class on IUView in the storyboard CareerButtonClass.
Here are what my files look like:
Still getting the same result.
Upvotes: 0
Views: 825
Reputation: 8512
The class you got from PaintCode is NSObject
and it’s right. StyleKit is a collection of all graphics you use in your app.
To render the button, you need to override drawRect
method in your UIView
. And call the method to draw the Career Button.
@IBDesignable
class CareerButtonClass: UIView {
override func drawRect(rect: CGRect) {
StyleKit.drawCareerButton()
}
}
See PaintCode FAQ #29.
Upvotes: 0
Reputation: 12061
For those who run by this post I finally found a good example here:
PaintCode Tutorial for Developers (Swift 2.0): Getting Started
Upvotes: 1
Reputation: 19912
That's because PaintCode exports a class with a collection of methods that you can use to draw the content.
Depending on the methods you choose, it can either generate a UIImage for you or you can call the code to draw in the current context.
It's up to you to implement where to use those methods.
Upvotes: 0