NMPopupManager Class Reference
| Inherits from | NSObject |
| Declared in | NMPopupManager.h NMPopupManager.m |
Overview
NMPopupManager is the service which manages popup notification flow. It provides means to register to popup notification service, to retrieve available popups, and to present popup objects on screen. All popup notifications are binded to some event, which means that related popup will be available to retrieve only after it’s binded event is fired.
Tasks
-
+ registerWithCompletionHandler:This method registers device to popup service with default settings. In this case, popup list is retrieved and updated from server only at times when application comes to foreground. See registerWithFetchPeriod:error: in order to set popup service a fetch interval.
-
+ registerWithFetchPeriod:completionHandler:Registers device to popup service with given period interval. If interval is given, popup list is updated from server periodically with given interval.
-
+ unregisterUnregisters device from registered popup service.
-
+ addObserver:forEventKey:usingBlock:Adds an object as an observer for the given event for triggered popups. When the relevant event fires, the given block is executed automatically. For an event, you can define as many as objects as an observer.
-
+ addObserverForAllEvents:usingBlock:Adds an object as an observer for all events for triggered popups. When any event fires, the given block is executed automatically. You can define as many as objects as an observer.
-
+ removeObserver:forEventKey:Removes the object registered as an observer for the regarding event. If a UIViewController object is added as an observer, it is highly recommended to call this method at least dealloc method of the relevant controller.
-
+ removeObserverForAllEvents:Removes the object registered as an observer for the all event. If a UIViewController object is added as an observer, it is highly recommended to call this method at least dealloc method of the relevant controller.
-
+ getTriggeredPopupsMethod to retrieve popups whose binded events are fired.
-
+ getTriggeredPopupsWithEventKey:Method to retrieve popups which are binded to event with given key.
-
+ presentPopup:Presents given popup object on top of current visible view controller. Popup will be shown in a controller with a full screen view, using a popping animation.
-
+ presentPopup:fromController:Presents given popup object on top of given view controller. Popup will be shown in a controller with a full screen view, using a popping animation.
Class Methods
addObserver:forEventKey:usingBlock:
Adds an object as an observer for the given event for triggered popups. When the relevant event fires, the given block is executed automatically. For an event, you can define as many as objects as an observer.
+ (void)addObserver:(id)object forEventKey:(NSString *)key usingBlock:(NMPopupTriggerResult)resultBlockParameters
- object
The object registered as an observer. It is recommended to set a UIViewController object to this parameter since it is easier to control the triggered popup object in a controller object.
- key
The description of an event which is requested to track for popup objects.
- resultBlock
The block to execute when the relevant event fires. It returns the triggered popups binded to the given event.
Discussion
Adds an object as an observer for the given event for triggered popups. When the relevant event fires, the given block is executed automatically. For an event, you can define as many as objects as an observer.
Declared In
NMPopupManager.haddObserverForAllEvents:usingBlock:
Adds an object as an observer for all events for triggered popups. When any event fires, the given block is executed automatically. You can define as many as objects as an observer.
+ (void)addObserverForAllEvents:(id)object usingBlock:(NMPopupTriggerResult)resultBlockParameters
- object
The object registered as an observer. It is recommended to set a UIViewController object to this parameter since it is easier to control the triggered popup object in a controller object.
- resultBlock
The block to execute when the relevant event fires. It returns the triggered popups binded to the given event.
Discussion
Adds an object as an observer for all events for triggered popups. When any event fires, the given block is executed automatically. You can define as many as objects as an observer.
Declared In
NMPopupManager.hgetTriggeredPopups
Method to retrieve popups whose binded events are fired.
+ (NSMutableArray *)getTriggeredPopupsReturn Value
An array of popup objects which are triggered by some event.
Discussion
Method to retrieve popups whose binded events are fired.
Declared In
NMPopupManager.hgetTriggeredPopupsWithEventKey:
Method to retrieve popups which are binded to event with given key.
+ (NSMutableArray *)getTriggeredPopupsWithEventKey:(NSString *)keyParameters
- key
Key of the requested event.
Return Value
An array of popup objects which are triggered by event with given key.
Discussion
Method to retrieve popups which are binded to event with given key.
Declared In
NMPopupManager.hpresentPopup:
Presents given popup object on top of current visible view controller. Popup will be shown in a controller with a full screen view, using a popping animation.
+ (void)presentPopup:(NMPopupObject *)objectParameters
- object
Popup notification object to be shown.
Discussion
Presents given popup object on top of current visible view controller. Popup will be shown in a controller with a full screen view, using a popping animation.
Declared In
NMPopupManager.hpresentPopup:fromController:
Presents given popup object on top of given view controller. Popup will be shown in a controller with a full screen view, using a popping animation.
+ (void)presentPopup:(NMPopupObject *)object fromController:(UIViewController *)parentControllerParameters
- object
Popup notification object to be shown.
Discussion
Presents given popup object on top of given view controller. Popup will be shown in a controller with a full screen view, using a popping animation.
Declared In
NMPopupManager.hregisterWithCompletionHandler:
This method registers device to popup service with default settings. In this case, popup list is retrieved and updated from server only at times when application comes to foreground. See registerWithFetchPeriod:error: in order to set popup service a fetch interval.
+ (void)registerWithCompletionHandler:(NMPopupRegisterResult)handlerParameters
- handler
The block to execute when registration is completed.
Discussion
This method registers device to popup service with default settings. In this case, popup list is retrieved and updated from server only at times when application comes to foreground. See registerWithFetchPeriod:error: in order to set popup service a fetch interval.
Declared In
NMPopupManager.hregisterWithFetchPeriod:completionHandler:
Registers device to popup service with given period interval. If interval is given, popup list is updated from server periodically with given interval.
+ (void)registerWithFetchPeriod:(NSTimeInterval)interval completionHandler:(NMPopupRegisterResult)handlerParameters
- interval
Time interval which determines the period at which popup list will be updated from server.
- handler
The block to execute when registration is completed.
Discussion
Registers device to popup service with given period interval. If interval is given, popup list is updated from server periodically with given interval.
Declared In
NMPopupManager.hremoveObserver:forEventKey:
Removes the object registered as an observer for the regarding event. If a UIViewController object is added as an observer, it is highly recommended to call this method at least dealloc method of the relevant controller.
+ (void)removeObserver:(id)object forEventKey:(NSString *)keyParameters
- object
The object registered as an observer.
- key
The description of the event which is not requested to listen any more.
Discussion
Removes the object registered as an observer for the regarding event. If a UIViewController object is added as an observer, it is highly recommended to call this method at least dealloc method of the relevant controller.
Declared In
NMPopupManager.hremoveObserverForAllEvents:
Removes the object registered as an observer for the all event. If a UIViewController object is added as an observer, it is highly recommended to call this method at least dealloc method of the relevant controller.
+ (void)removeObserverForAllEvents:(id)objectParameters
- object
The object registered as an observer.
Discussion
Removes the object registered as an observer for the all event. If a UIViewController object is added as an observer, it is highly recommended to call this method at least dealloc method of the relevant controller.
Declared In
NMPopupManager.hunregister
Unregisters device from registered popup service.
+ (void)unregisterDiscussion
Unregisters device from registered popup service.
After you unregister device, calls to getTriggeredPopups and getTriggeredPopupsWithEventKey: methods will return empty array.
Declared In
NMPopupManager.h