Skip to content
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

Image Support #33

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Image Support #33

wants to merge 6 commits into from

Conversation

osrl
Copy link

@osrl osrl commented Jan 25, 2015

I'm sure this is not the perfect way to do this. Maybe a block mechanism should be implemented. But this works too. No offence taken if you don't merge this. Maybe someone use it

Added a NSTextAttachment+Image category to load images async. It throws posts a notification named imageLoadedNotification every time an image is loaded

catch this notification with
NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("imageLoaded"), name: "imageLoadedNotification", object: nil)

Add this function so it draws the label everytime an image is loaded.

func imageLoaded() {
    self.label.setNeedsDisplay()
    self.label.setNeedsUpdateConstraints()
}

Don't forget to remove observer:

deinit {
    NSNotificationCenter.defaultCenter().removeObserver(self)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant