Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Inital badge project created with example #29

Closed
wants to merge 18 commits into from

Conversation

rogchap
Copy link
Contributor

@rogchap rogchap commented Aug 3, 2011

This is only an early version of a badge view using QuartzCore.
Does not have a badge "gloss" yet and also not yet documented.

Challenges:

  • getting the right badge size for the font used; perhaps we should use a set font with a scale factor instead of allowing the user to change the font??
  • the drop shadow is clipped when using a smaller font; need to add more padding to the view - DONE

@bmeurer
Copy link
Contributor

bmeurer commented Aug 14, 2011

Shouldn't -setText: invoke -setNeedsLayout rather than -setNeedsDisplay?

@rogchap
Copy link
Contributor Author

rogchap commented Aug 14, 2011

No, as it's not doing a sub layout as everything is manually drawn onto the view. -setNeedsDisplay will invoke -drawRect which is what is required.

There is a previous comment on this.

Sent from my iPhone

On 14 Aug 2011, at 16:39, bmeurerreply@reply.github.com wrote:

Shouldn't -setText: invoke -setNeedsLayout rather than -setNeedsDisplay?

Reply to this email directly or view it on GitHub:
#29 (comment)

@bmeurer
Copy link
Contributor

bmeurer commented Aug 14, 2011

-setText: is different, because the size depends on the actual text in your -sizeThatFits: implementation, so relayouting makes sense when text changes.

@rogchap
Copy link
Contributor Author

rogchap commented Aug 14, 2011

Even the text is drawn within -drawRect, therefore I want -drawRect to be called which -setNeedsDisplay does. Only if text was being added via UILabel in overriding the -layout method would -setNeedsLayout be required.

That's my understanding of it anyway...will happily be corrected :)

Sent from my iPhone

On 14 Aug 2011, at 20:17, bmeurerreply@reply.github.com wrote:

-setText: is different, because the size depends on the actual text in your -sizeThatFits: implementation, so relayouting makes sense when text changes.

Reply to this email directly or view it on GitHub:
#29 (comment)

@bmeurer
Copy link
Contributor

bmeurer commented Aug 14, 2011

I'm not an expert in the UIView programming stuff, but my understanding is that -setNeedsLayout triggers layout, which in turn triggers redisplay, and whenever something is about to change the (preferred) size of an UIView it should invoke -setNeedsLayout.

But as said, that's just how I read the documentation.

@bmeurer
Copy link
Contributor

bmeurer commented Aug 14, 2011

Forget about that. I stand corrected. -setNeedsLayout is only for subviews of the receiver.

@rogchap
Copy link
Contributor Author

rogchap commented Aug 17, 2011

This should be in a decent state now; with documentation, and rebased with current master (0.6.1). Let me know if there are any changes required?

@jverkoey
Copy link
Owner

Will do! I'm going to play with this a bit today I think after I write unit tests for the Nimbus Models.

@0xdevalias
Copy link
Contributor

Just wondering whether this is pretty much completed now?

@rogchap
Copy link
Contributor Author

rogchap commented Sep 30, 2011

This should be ready :)

@jverkoey jverkoey mentioned this pull request Oct 25, 2011
@jverkoey jverkoey closed this in 70ea759 Jun 20, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants