evgenyneu / Cosmos

A star rating control for iOS/tvOS written in Swift
MIT License
2.19k stars 368 forks source link

Error when load it to TableView #23

Closed khuong291 closed 8 years ago

khuong291 commented 8 years ago

I drag a view and set its class to CosmosView, but when I run the project, it crashes:

Failed to set (rateLineWidth) user defined inspected property on (Cosmos.CosmosView): [<Cosmos.CosmosView 0x7ff150d53e70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key rateLineWidth.

evgenyneu commented 8 years ago

Hello, @khuong291. I think I had similar problem in the past and solved by clearing "User defined runtime attributes" for the cosmos view (shown in the screenshot).

I have also made a quick test and put cosmos in a table view, could not reproduce your issue (see the attached demo project).

Let me know how it goes.

UsingCosmosInTableView.zip

runtime_attributes
khuong291 commented 8 years ago

I have not tried your example project yet. But now It works well.

screen shot 2016-04-17 at 10 56 33 am Thanks @evgenyneu. +1 ⭐ 👍

evgenyneu commented 8 years ago

I am glad it worked. Feel free to comment if you have any other issues. Have a good day.

khuong291 commented 8 years ago

Can I ask one more question: Is CosmosView Rating max = 5

khuong291 commented 8 years ago

I think it would more covenient if you can add one more choice like so: cosmosView.ratingWithRatio(starCount: 5, maxRating: 100) = 90 So the CosmosView will have 4.5 star. 😸

evgenyneu commented 8 years ago

Sorry, I do not understand your question. Can you give me an example of what you want to achieve in your app?

khuong291 commented 8 years ago

For example, I want to rating a movie, its rating has 94/100 point, So I the CosmosView.rating should be 94*5/100 = 4.7 if I want maximum with 5 star.

So If I want to use with 10 star, it should be 94*10/100 = 9.4.

I just recomend for you to implement more 😄

khuong291 commented 8 years ago

Oh, sorry, you have done with it. My fault.

evgenyneu commented 8 years ago

I do value your recomendations, @khuong291. I just wanted to understand what you meant. Did you want Cosmos to show ten stars with rating 9.4? If so you can currently do it like this:

cosmosView.settings.totalStars = 10
cosmosView.settings.fillMode = .Precise // Others are .Half and .Full
cosmosView.rating = 9.4

Or you can do it from the Storyboard as well:

ten_stars

This is described in the configuration manual.

And thank you very much for the feedback.

khuong291 commented 8 years ago

Yes, I don't read your guide carefully, sorry. Your project is awesome 👍

MasterHM-ios commented 4 years ago

Hello, @khuong291. I think I had similar problem in the past and solved by clearing "User defined runtime attributes" for the cosmos view (shown in the screenshot).

I have also made a quick test and put cosmos in a table view, could not reproduce your issue (see the attached demo project).

Let me know how it goes.

UsingCosmosInTableView.zip

runtime_attributes

this solution solved my problem. thanks cleared user defined attributes from storyboard