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
Custom Image #36
Comments
i try to storyboard, but apps are crash sorry my eng |
Hi @kyominoh! I find that very strange, because those properties are Can you share a simple sample project where that happens? (you can zip it and paste the dropbox link here) |
https://www.dropbox.com/s/7qwa133kmjmx2xd/KKariPeopleFixMe.zip?dl=0 Here is a simple source |
The problem is that you're not using ARC, so when you do this: _ratingView.filledStarImage = [[UIImage imageNamed:@"like_off_big"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; I'm doing this: - (void)setFilledStarImage:(UIImage *)filledStarImage {
if (_filledStarImage != filledStarImage) {
_filledStarImage = filledStarImage;
[self setNeedsDisplay];
}
} As you can see, my code is ARC-only (ie. I'm not retaining anything because ARC does that for me) and you just provided that setter an autoreleased object. That means that the object will get released on the next runloop, resulting in the error you're seeing. My advice is to get on the ARC boat, since it's awesome... but if you must stay away from ARC, add the Please note that you will have the exact same type of problems if you use a lot of other controls from GitHub, since almost all of them require ARC nowadays (but you can definitely use the flag approach above for other controls). |
Thanks Bro, |
No worries man, glad I could help. 👍 |
thanks shared source |
Hi, bro
I have a problem with RatingView that u posted on Github.
I applied the following source to use a different image, not the existing star image, as you wrote.
starRatingView.emptyStarImage = [UIImage imageNamed:@"heart-empty"]; //like_off_big.png
starRatingView.filledStarImage = [UIImage imageNamed:@"heart-full"];//like_on_big.png
I could see the new image that I put in on RatingView, but when I tried to run RatingView, apps crash. (touched RatingView)
The reason for the crash is
[UIImage renderingMode]: message sent to deallocated instance
I used call stack and figured out the following code occurred the error.
[self _drawStarWithFrame:frame tintColor:self.tintColor highlighted:highlighted]; in drawRect:(CGRect)rect
Could you please let me know how to solve this problem?
Thank you.
The text was updated successfully, but these errors were encountered: