Open kiwo12345 opened 9 years ago
I solved it by doing this in DOFavoriteButton.swift:
private func createLayers(image image: UIImage!) {
...
let imageFrame = self.frame
let imgCenterPoint = CGPointMake(CGRectGetMidX(imageFrame), CGRectGetMidY(imageFrame))
let lineFrame = self.frame
...
}
First you have to define the frame
for the button.
@vicorente I implemented the above code, but I don't see any button on the view. Is this something to do with defining the frame
? If so, can you please guide me?
Sure!! Show me your code here...
I defined a frame for likeButton
in viewDidLoad
likeButton.frame = CGRect(x: 220, y: 330, width: 22, height: 24)
And I have implemented your code in DOFavoriteButton.swift. But nothing shows up in the simulator.
Create yout likeButton like this:
let likeButton = DOFavoriteButton(frame: CGRectMake(0,0,44,44), image: UIImage(named: "likeImage")!)
After this check that you add the button as a subview of any view in your view controller.
Thanks! I'll try this.
In create layer function, just change the imageFrame like
private func createLayers(image image: UIImage!) { .... let imageFrame = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height) ...... }
Then it will work. Dont know why the developer kept those parameters but above parameters are correct.
First off, thanks for sharing this! Is there a way to change the image size? Increasing the button size does not work.