透明view control

iOS开发之Present ViewController Modally --弹出模态ViewController

iOS模态弹出半透明视图控制器



前个界面

#pragma mark - 点击事件

-(void)touchLeft:(id)sender

{

NSLog(@"touchLeft");

ManagerNewFilterViewController *ManagerNewFiltervc=[[ManagerNewFilterViewController alloc]init];

ManagerNewFiltervc.modalPresentationStyle=4;

ManagerNewFiltervc.modalTransitionStyle=2;

ManagerNewFiltervc.sendFilterId=^(NSMutableArray *theAry)

{

NSLog(@"*****theAry--%@",theAry);

self.context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];

self.context[@"jsCall"] = self;

//要实现代理,其中jsCall是js的对象,就要把当前对象传给js

// 打印异常,由于JS的异常信息是不会在OC中被直接打印的,所以我们在这里添加打印异常信息,

self.context.exceptionHandler =

^(JSContext *context, JSValue *exceptionValue)

{

context.exception = exceptionValue;

NSLog(@"异常信息===%@", exceptionValue);

};

NSMutableDictionary *dic=[[NSMutableDictionary alloc]init];

for (newFilterModel *model in theAry)

{

NSNumber *number=[[NSUserDefaults standardUserDefaults]objectForKey:[NSString stringWithFormat:@"%@%@",model.label,model.name]];

NSDictionary *theDic=[model.items objectAtIndex:[number integerValue]];

[dic setObject:[theDic objectForKey:@"value"] forKey:model.name];

[_selectAry addObject:@{[NSString stringWithFormat:@"%@%@",model.label,model.name]:[theDic objectForKey:@"value"]}];

/////

[[NSUserDefaults standardUserDefaults]removeObjectForKey:[NSString stringWithFormat:@"%@%@",model.label,model.name]];

[[NSUserDefaults standardUserDefaults]synchronize];

}

NSLog(@"******dic--->:%@",dic);

NSString *alertJS2=[NSString stringWithFormat:@"filter_list('%@')",[dic mj_JSONString]]; //准备执行的js代码

[self.context evaluateScript:alertJS2];

};

ManagerNewFiltervc.currentSelectAry=_selectAry;

[self presentViewController:ManagerNewFiltervc animated:YES completion:^{}];

}


弹出界面.m

@implementation ManagerNewFilterViewController

- (void)viewDidLoad {

[super viewDidLoad];

// Do any additional setup after loading the view.

self.view.backgroundColor=[UIColor clearColor];

[self initNavigationBar];

[self initDatasource];

[self initWithcontrols];

[self getFilterRequest];

}

你可能感兴趣的:(透明view control)