hsousa / hcsstarratingview Goto Github PK
View Code? Open in Web Editor NEWSimple star rating view for iOS written in Objective-C
License: MIT License
Simple star rating view for iOS written in Objective-C
License: MIT License
it can display on Xcode(7) simulator(iOS9).
But it cannot display on my iPhone(iPhone6 iOS10), cannot see any thing but can touch.
Hello,
First, thanks for sharing this library with us, it's really great.
I'm facing a problem which my tap gesture seems not to be recognized by the UIView.
I did a quick search in the list of closed issues and I found out that I should change is enabled
property to false
.
I did it and set UserInteractionEnabled
to true
, but even so my tap gesture still don't work. Do you have any idea what I'm doing wrong?
Here's the full code
reviewsNumber.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.openReviews(_:)))) reviewsNumber.isEnabled = false reviewsNumber.isUserInteractionEnabled = true
There seems to be a problem with setting the spacing
to a value below 5 when the control is embedded in a UIStackView
.
To reproduce this:
HCSStarRatingView
and set the spacing to something below 5Now, when you build and run, it will actually draw correctly in the demo project, but in my own project, it won't, the spacings will be incorrect. I'm not entirely sure if this is really a problem on my side, but I think it's got something to do with the way intrinsicContentSize
is calculated. Since you're pinning the height to 44, the spacing will always be incorrect when you constrain the view to a different height.
I need just show the stars and the user can't change them but when the users tap the rating view show an alert. Is that possible ?
tableview can not scroll if finger in our starRateView.I change it inherit UIView resolve this. If author have a better Solution
Is this possible ?
I would like different star colors for each star when only one color is set for all of them now.
Can you help me with this?
Hello friends,
I am having problem using HCSStarRatingView in UICollection Cell.
How to setup HCSStarRatingView view in UICollection view cell Swift 3?
HCSStarRatingView star value set keeps on changing when rating view in UICollectionView Cell and collection view is scrolled.
I added HCSStarRatingView on UICollection View Cell in storyboard.
Created strong outlet of HCSStarRatingView as
@IBOutlet var ratingView: HCSStarRatingView!
Then in collection view cell for index path code is like this.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = self.collectionVC.dequeueReusableCell(withReuseIdentifier: "collectionCell", for: indexPath as IndexPath) as! CustomCollectionViewCell
cell.ratingView.value = (self.ratingValueDataArray.value(forKey: "rating") as AnyObject).object(at:indexPath.row) as! CGFloat // setting rating value from JSON array response.
return cell
}
However, for first time value is set on rating view correctly. But on collection view scroll the value is changed on random manner.
Any help?
Thanks
I'm using rating views in table view cells, where I set the rating value in the cellForRow:
method of the table view's data source. It works fine in all cases, except when the value I'm trying to set is 0. In this case, the rating view retains some random value for some reason, and completely ignores the 0.
i got this error, “HCSStarRatingView.framework/HCSStarRatingView' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)” please support bitcode
Hi. Can you release a new version without using IB_DESIGNABLE?
Apple has released a huge bug in Xcode 6.3 ( http://stackoverflow.com/questions/29544738/xcode-6-3-freezes-hangs-after-opening-xib-file ) and this causes the storyboard to freeze.
Might help some users until Apple decides to fix their mistakes.
Hello sir, I have added the star rating view in my app. But i have an issue if i use the star rating in view controller its working fine but if i use this in a table view for multiple rows then the rating is not show properly. if i scroll the tableview the value of upper cells that contains rating view is changed. Please suggest me what can i do to implement it in tableview??
I think it would work fine with iOS7 too, wouldn't it ?
Hi,
How can I change the rating blocks into rectangular block. My desired UI is to make into rectangular bar.
Any help much appreciated.
After setting the value, it seems that the value does not get updated.
if I do rating.value = 0
and in the IB the value was 2, it still keeps the value from IB.
...storyboard: error: IB Designables: Failed to render and update auto layout status for ViewController (CvE-oC-4JB): Failed to load designables from path (null)
installing via pod this happens every time I try to use this class in interface builder and then everything disappears (doesnt render) from the view.
Related to #18, doesn't really make sense to keep having 'star' in the name.
Might be a good idea to take the opportunity to rename/re-organize some properties as well, since version 2.0 will include major changes.
Hi guy: Is it possible to add one parameter as optional?
Just for show
Can we get a podspec? 😬 🍻
Public headers should be documented inline.
Might also be worth creating a cocoadocs.org-compatible documentation.
There seems to be a issue when trying to preview the view with the framework using carthage. Mine fails to render and complains that the target is missing.
Hi Hugo :
I believe that set the 'value' in storyboard or manually in code shouldn't trigger UIControlEventValueChanged. It might not a perfect match for the idea 'UIControlEvent'.
To test my thoughts, I just create a UISegmentedControl and set the 'selectedSegmentedIndex' in code, it didn't trigger UIControlEventValueChanged. But when you click a segment, it did trigger. So shall we follow this routine too?
hey is there a way to make it fill the stars from the other direction ( from right to left)???
Installed via Cocoapods 0.37.2. Xcode 6.4.
There are 2 red errors shows up on the left side of Xcode. I can build and run the app but the page that has this view goes blank.
xxx/Driver.storyboard: error: IB Designables: Failed to update auto layout status: Failed to load designables from path (null)
xxx/Driver.storyboard: error: IB Designables: Failed to render instance of HCSStarRatingView: Failed to load designables from path (null)
Btw, I didn't use use_frameworks!
in the Podfile. Is it required?
How to observe value changed?
Hello, I've created one and set minimum value to1. Yet if you swipe over to left border of view, view shows 0 stars highlighted, but value is still 1.0.
I've looked around, but not exactly sure where to make change. Maybe we should use setValue:
inside _handleTouch
and check if it's smaller than minimum here?
How do I make this view not editable (without removing User Interaction Enabled
because I need it)
This control evolved into a much more customised solution. The idea might be to have a set of default shapes (star, circle, etc) that can be chosen, as well as public and easy support for custom shapes.
When using half stars, the rating is aways rounded up like so:
For a value of 2.1, the rating view shows 2.5 stars when it should show only 2 stars.
Any properties that handle this? Any way to change that behavior if not?
Could you please add a delegate? I would like to be notified about value changes similarly to other UIControl
classes. I think about something similar as:
- (void)starRatingView:(HCSStarRatingView *)starRatingView didChangeValueTo:(CGFloat)value;
I'm using storyboard. I selected the View and selected the background as "clear" and kept white.
To remove the background I had to define background as UIColor.clear()
I add HCSStarRatingView into UITableViewCell
Just change HCSStarRatingView value, When you scroll in the presence of "HCSStarRatingView" it does not scroll
I set tableView.delaysContentTouches = true; but not working..
Within Xcode 7.0.1 I get the following error in the storyboard:
file:///../Main.storyboard: error: IB Designables: Failed to update auto layout status: The bundle “$(PRODUCT_NAME)” couldn’t be loaded because its executable couldn’t be located.
And there is no preview of the component
Hi @hugocampossousa
I was always fail to find a nice rating view until I found this one. But it hasn't been pushed to cocoapods yet so that we had to specify the git address after 'pod'. Is there a spefific reason why?
I’m getting the error mentioned in title while trying to install through cocoapods.
I have added the StarRatings to Interface builder. and using side panel i can update the values and set images fine. but when ever i try to update the values it doesnt effect.
I simply created outlet and created following.
_starRatings = [HCSStarRatingView new];
_starRatings.minimumValue = 0.0;
_starRatings.maximumValue = 5.0;
_starRatings.maximumValue = 2.0;
_starRatings.emptyStarImage = [UIImage imageNamed:@"star_empty"];
_starRatings.filledStarImage = [UIImage imageNamed:@"star_full"];
only displaying values that i added in interface builder.
I am using custom images , tried increasing height of the view but the size of the image is not increased. Whats the work around. i am using constraints for build the view.
How would you set the touch increment on the stars to increase by half a star each time as your slide? I have set in IB to allow half star and accurate half star, but the selection is still continuous.
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.
Hello and thank you for your work.
I am trying to set the value with .value = ... but the stars don't fill up :(
Any clue on why does this happen?
Thanks
When I used different image between emptyStarImage and filledStarImage in iOS8, but it can't show the emptyStarImage. I don't know why, please help me. Thank you.
Related to discussion in #42, ideally this control would have a behaviour similar to what's currently found in iTunes: when dragging to the left of the control (x<=0), the value 0
is assigned on touch up.
Hi this library is amazing, i have only a question, i have a custom image of a star, it's possible to use it in this library?
First of all i would to say Thanks for great library i am facing some issue like
if i give the rating once so it become full of colour of star,now i want to keep remain if user appear next time into that screen. please help me out!
Beacause of I want to use SDK(contains C++), AppDelegate.m to AppDelegate.mm,the “@import UIKit” products error
Hi,
I currently have an issue with my project. It worked fine so far but when trying to add your cocoapod using
pod 'HCSStarRatingView'
and then using a UIView with class HCSStarRatingView, it displays fine.
But when I want to obtain the selected value, I ctrl-click from the IB to the .h file of my controller, and create:
@property (weak, nonatomic) IBOutlet HCSStarRatingView *rating;
of course the compiler complains to not know HCSStarRatingView, so I add the import above:
#import <HCSStarRatingView/HCSStarRatingView.h>
But that gives the error
Use of '@import' when modules are disabled
pointing at
@import UIKit;
within HCSStarRatingView.h in the source code.
I have searched on google and suggestions claim that Enable modules (C and Objective-C)
should be set to Yes, but I don't understand why that would be required, before I have never had this error before adding this Pod.
Are you familiar with the error Use of '@import' when modules are disabled
?
Am I using it wrongly, by coupling the HCSStarRatingView with an IBOutlet?
Thanks
It seems it's not possible but in case I'm missing something I thought I'd to ask :)
Is any way to disallow edition. I'd like to use the same control to provide the feedback and for showing it on a list.
Great work on this, thanks for sharing!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.