#import “ViewController.h”
#import “RNBlurModalView.h”
#import <QuartzCore/QuartzCore.h>
@interface ViewController ()
@end
@implementation ViewController
– (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
//弹出消息框
– (IBAction)dialogView:(id)sender {
BOOL useCustomView = NO;
RNBlurModalView *modal;
if (useCustomView) {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
view.backgroundColor = [UIColor redColor];
view.layer.cornerRadius = 5.f;
view.layer.borderColor = [UIColor blackColor].CGColor;
view.layer.borderWidth = 5.f;
modal = [[RNBlurModalView alloc] initWithView:view];
}
else {
modal = [[RNBlurModalView alloc] initWithTitle:@”Hello world!” message:@”This is the default modal for RNBlurModalView. Feel free to pass any UIView to it as you wish!”];
}
[modal show];
}
//弹出一个UIView
– (IBAction)dialogView2:(id)sender{
BOOL useCustomView = NO;
RNBlurModalView *modal;
if (useCustomView) {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
view.backgroundColor = [UIColor redColor];
view.layer.cornerRadius = 5.f;
view.layer.borderColor = [UIColor blackColor].CGColor;
view.layer.borderWidth = 5.f;
modal = [[RNBlurModalView alloc] initWithView:view];
}
else {
UIView *messView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 150)];
[messView setBackgroundColor:[UIColor blackColor]];
UILabel *messContent = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 150, 30)];
messContent.text = @”this is add UILable”;
[messView addSubview:messContent];
modal = [[RNBlurModalView alloc] initWithView:messView];
}
[modal show];
}
PS:
demo下载地址:http://www.kuaipan.cn/file/id_82777686379857081.htm