Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to change the image size #16

Open
kiwo12345 opened this issue Oct 5, 2015 · 7 comments
Open

Is there a way to change the image size #16

kiwo12345 opened this issue Oct 5, 2015 · 7 comments

Comments

@kiwo12345
Copy link

First off, thanks for sharing this!
Is there a way to change the image size? Increasing the button size does not work.

@vicorente
Copy link

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.

@itsaark
Copy link

itsaark commented Feb 15, 2016

@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?

@vicorente
Copy link

Sure!! Show me your code here...

@itsaark
Copy link

itsaark commented Feb 16, 2016

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.

@vicorente
Copy link

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.

@itsaark
Copy link

itsaark commented Feb 20, 2016

Thanks! I'll try this.

@Shahid452
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants