CosmicMind / Material

A UI/UX framework for creating beautiful applications.
http://cosmicmind.com
MIT License
11.98k stars 1.26k forks source link

CardView.divider = false causing cardView to disappear #87

Closed sohayb closed 8 years ago

sohayb commented 8 years ago

When I set the cardView divider property to false, the cardView just disappears, I had to set the divider color to clear color to get my desired look.

daniel-jonathan commented 8 years ago

I am not able to reproduce the issue.

  1. Is this using Storyboards?
  2. Version of test device?
  3. May you send some code that shows the construction of the CardView?
sohayb commented 8 years ago
  1. Yes, I am using the CardView in a StoryBoard,
  2. Testing in iPhone 6 simulator, iOS 9.1
  3. Where I can send you the sample code?
daniel-jonathan commented 8 years ago

If you do not want it to be public, please send to support@cosmicmind.io :)

sohayb commented 8 years ago

Preparing the sample now :)

daniel-jonathan commented 8 years ago

Hey @sohayb :)

I reviewed your example code and I believe it is best I answer here so that others may learn from the issue you had pointed out. Within the CardView there is a method called reloadView that is called when a property is altered from its original value, in this case CardView.divider = false. Internal to the reloadView method, AutoLayout is used to create the CardView layout. It looks that the CardView is not actually holding any of its known property values, and a UILabel is added to the CardView to create the effect you are looking for. Since the CardView doesn't have a titleLabel, detailLabel, buttons, or divider, it concludes using AutoLayout that there is not anything to layout and a height of 0 is applied.

My suggestion would be to use a MaterialView in this case, which would give you the backgroundColor, shadow, and shape that it looks like you are trying to achieve. If you want a pulse animation, you can use the MaterialPulseView, and if you are looking for a button.target, the RaisedButton looks to be the one you would want in this instance.

Thoughts?

sohayb commented 8 years ago

You're right, I'm not using the CardView where it's supposed to be used, so the error is by design (my case is an odd one, sry for that :) ) Wanted to place a button with an image on it, so I should be better off with the MaterialPulseView. Closing this for now

daniel-jonathan commented 8 years ago

No worries. If you want a button, why not use one of the MaterialButtons? They are fully customizable like the views. They also support an image layer with button.setImage(…)


Daniel Dahan

M: +1 647.627.0770 Skype: djondahan

On Dec 13, 2015, at 2:41 PM, Sohayb Hassoun notifications@github.com wrote:

You're right, I'm not using the CardView where it's supposed to be used, so the error is by design (my case is an odd one, sry for that :) ) Wanted to place a button with an image on it, so I should be better off with the MaterialPulseView. Closing this for now

— Reply to this email directly or view it on GitHub https://github.com/CosmicMind/MaterialKit/issues/87#issuecomment-164290407.