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

Add option to set a custom view class. #82

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

Conversation

mkantor
Copy link
Contributor

@mkantor mkantor commented Jul 14, 2014

This changeset enables the creation of custom layouts for notifications. I had to make a few things public that weren't before, namely the option defaults system and some parts of CRToastView, but hopefully the extra functionality is worth it.

Matt Kantor added 3 commits July 11, 2014 11:55
In preparation for allowing custom notification views.
Use this to tighten up the validation for the notification view class
option.
@mkantor
Copy link
Contributor Author

mkantor commented Jul 14, 2014

The reason that I made the CRToast options/defaults public is because some of them are pretty necessary to create a good layout (e.g. displayUnderStatusBar, text/fonts, etc).

If this is too much exposure, I could make client code keep track of this stuff itself, but the defaults would have to be duplicated since they currently aren't available from the outside.

@cruffenach
Copy link
Owner

Hmmm, I really wanna add this feature, but I was thinking more an opt in and bring your own view kinda thing or use the built in stuff. Kinda like UITableViewCell. This would avoid exposing all these formerly private properties. This is pretty neat though and allows for the functionality of all the options to stay intact even when providing your own layout code. Gotta think on this one...

@@ -908,7 +870,7 @@ - (void)setOptions:(NSDictionary *)options {
key,
obj);
[cleanOptions removeObjectForKey:key];
} else if (![obj isKindOfClass:NSClassFromString(kCRToastKeyClassMap[key])]) {
} else if (![[obj class] isSubclassOfClass:NSClassFromString(kCRToastKeyClassMap[key])]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has the same behavior as isKindOfClass for instances, but will also work as expected on Class objects.

@SPopenko
Copy link

Guys, when you plan to marge this useful stuff?

@Ashton-W
Copy link
Collaborator

Since @cruffenach has weighed in I don't want to jump the gun. It's up to him - once he has the time.

👍 from me.

@ghost
Copy link

ghost commented May 12, 2017

Any plans to merge this CR? I need exactly this in my project and may have to fork the repo if not provided.

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.

4 participants