在 iOS 上提供了一个公开的弹出视图 YHPopupView,可以使用并方便地自定义。然后您可以通过您想显示的上下文来关注视图。
通过 CocoaPods 安装是首选方式。只需添加
pod 'YHPopupView'
然后运行 pod install
。它将安装 YHPopupView 的最新版本。
如果您想使用 YHPopupView 的最新代码,请使用
pod 'YHPopupView', :head
###YHPopupView
#import "ViewController.h"
#import "YHPopupView.h"
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
YHPopupView *popupView = [[YHPopupView alloc] initWithFrame:CGRectMake(50, 50, 200, 200)];
popupView.clickBlankSpaceDismiss = YES;
// You can add subview in need
popupView.backgroundColor = [UIColor blueColor];
[self presentPopupView:popupView];
}
@end
###YHMessageView
- (IBAction)showMessageView:(id)sender {
YHMessageView *messageView = [[YHMessageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 80)];
messageView.showTime = 3;
messageView.backgroundColor = [[UIColor alloc] initWithWhite:0 alpha:0.5];
messageView.delegate = self;
[messageView addSubview:label];
[self presentMessageView:messageView];
}
#pragma mark - YHMessageView Delegate
- (void)tapMessageView:(YHMessageView *)messageView {
NSLog(@"tap messageView");
}
@end
v0.2.0 添加 YHMessageView
v0.1.0 第一个版本