EMNotificationPopup 是一个可定制、易于使用且带有良好动画的通知弹出窗口。
或者您可以简单地复制文件夹 EMNotificationPopup 中包含的所有文件,然后开始玩弄它!
@interface EMNotificationPopup : UIView
@property NSObject <EMNotificationPopupDelegate> *delegate;
@property (nonatomic, strong) NSString *actionTitle;
@property (nonatomic, strong) UIImage *image;
@property (nonatomic, strong) NSString *subtitle;
@property (nonatomic, strong) NSString *title;
// Init default View
- (id) initWithType: (EMNotificationPopupType) type enterDirection:(EMNotificationPopupDirection) enter exitDirection:(EMNotificationPopupDirection) exit popupPosition: (EMNotificationPopupPosition) position;
// Init custom view
- (id) initWithView:(UIView *)view enterDirection:(EMNotificationPopupDirection) enter exitDirection:(EMNotificationPopupDirection) exit popupPosition: (EMNotificationPopupPosition) position;
// Actions on the popup view
- (void) dismissWithAnimation:(BOOL) animate;
- (void) show;
- (BOOL) isVisible;
// (new in 0.2.2) Customize the bounce power
- (void) setBouncePower:(NSInteger) bouncePower;
// Customize the default view
- (void) setPopupActionBackgroundColor: (UIColor *) color;
- (void) setPopupActionTitleColor: (UIColor *) color;
- (void) setPopupBorderColor: (UIColor *)color;
- (void) setPopupBackgroundColor:(UIColor *)color;
- (void) setPopupSubtitleColor:(UIColor *)color;
- (void) setPopupTitleColor:(UIColor *)color;
@end
@protocol EMNotificationPopupDelegate
- (void) emNotificationPopupActionClicked;
@end
EMNotificationPopup *notificationPopup = [[EMNotificationPopup alloc] initWithImage:[UIImage imageNamed:@"alert_image"] andTitle:@"Hi, this is an alert message!" andSubTitle:@"Sorry for this message :)" andButtonTitle:@"OK"];
notificationPopup.delegate = self;
[notificationPopup showWithEnterDirection:EMNotificationPopupToDown andExitDirection:EMNotificationPopupToLeft];
这是一个使用“大”通知弹出窗口的示例。这是一个很大的(比大还要高)通知,能够显示图像、标题和副标题。如果实例化 EMNotificationPopupBigButton,您可以自定义动作按钮标题和颜色。此按钮用于关闭视图。
_notificationPopup = [[EMNotificationPopup alloc] initWithType:notificationPopupType enterDirection:EMNotificationPopupToDown exitDirection:EMNotificationPopupToLeft popupPosition:position];
_notificationPopup.delegate = self;
_notificationPopup.title = @"Sorry for this Alert message :)";
_notificationPopup.subtitle = @"Awesome message :)";
_notificationPopup.image = [UIImage imageNamed:@"alert_image"];
if (notificationPopupType == EMNotificationPopupBigButton)
_notificationPopup.actionTitle = @"OK";
[_notificationPopup show];
这是一个使用“瘦”通知弹出窗口的示例。这是一个瘦长的矩形通知,只能显示标题。
_notificationPopup = [[EMNotificationPopup alloc] initWithType:EMNotificationPopupSlim enterDirection:EMNotificationPopupToDown exitDirection:EMNotificationPopupToLeft popupPosition:position];
_notificationPopup.delegate = self;
_notificationPopup.title = @"Sorry for this Alert message :)";
[_notificationPopup show];
可以通过以下方法轻松地使用以下方法对这两个视图进行自定义:
- (void) setPopupActionBackgroundColor: (UIColor *) color;
- (void) setPopupActionTitleColor: (UIColor *) color;
- (void) setPopupBorderColor: (UIColor *)color;
- (void) setPopupBackgroundColor:(UIColor *)color;
- (void) setPopupSubtitleColor:(UIColor *)color;
- (void) setPopupTitleColor:(UIColor *)color;
UIView *shownView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 250.0f, 125.0f)];
shownView.backgroundColor = [UIColor redColor];
UIButton *closeMe = [[UIButton alloc] initWithFrame:CGRectMake(shownView.frame.size.width - 25.0f, 3.0f, 22.0f, 22.0f)];
closeMe.backgroundColor = [UIColor clearColor];
[closeMe setBackgroundImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];
[closeMe addTarget:self action:@selector(dismissMe) forControlEvents:UIControlEventTouchDown];
[shownView addSubview:closeMe];
_notificationPopup = [[EMNotificationPopup alloc] initWithView:shownView enterDirection:EMNotificationPopupToRight exitDirection:EMNotificationPopupToRight popupPosition:position];
_notificationPopup.delegate = self;
[_notificationPopup show];
My Soldier for Battlefield 4 Smartcomix
如何做?简单地免费分支该项目并改进它!
如果您想联系我:Twitter: ennioma. 电子邮件: [email protected]