Closed jadar closed 9 years ago
So I've been thinking about this some and I'm not sure a subclassing pattern like that used in UIGestureRecognizer
makes sense. With gesture recognizers you usually have multiple since there are multiple types of gestures that can be done and different contexts for each gesture. I'm not sure the same pattern applies to something like a toast notification manager.
As it stands right now, in master
you can set notification identifiers and dismiss all notifications with an identifier. You could create an intermediate layer in between what your class calls and CRToast
so that when you send a success notification it automatically dismisses all loading notifications.
For example,
@implementation ToastManager: NSObject {
+ (void)showSuccessNotification(message: String) {
[CRToastManager dismissAllNotificationsWithIdentifier:@"Loading.ToastIdentifier" animated:YES];
[CRToastManager showNotificationWithMessage:@"Loaded!"];
}
@end
(just kind of typed that in so there are probably typos/syntax errors)
Yes, that solution work out alright.
I want to make a notification that would inform the user with an activity indicator when that application is loading data. When the data is done loading, presenting a success notification would automatically dismiss all notifications with the "loading" identifier.
I'm thinking the best way to go about this would be to subclass CRToastManager; but CRToastManager only exposes class methods. Would it be a good idea to implementing a subclassing design similar to UIGestureRecognizer–where there is a Subclass header which declares the "protected" methods?