主要操作:(用來io7以下)

1. 视图1(ViewController1)中添加以下代码

ViewController2 *lagerPicVC = [[ViewController2 alloc]init];

self.modalPresentationStyle = UIModalPresentationCurrentContext;//关键语句,必须有

[self presentViewController:lagerPicVC animated:YES completion:nil];

2. 视图2(ViewController2)中设置背景透明度

 

[self.view setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.868f]];

 

ios8用以下:

Before iOS 8, you do this:

[backgroundViewController setModalPresentationStyle:UIModalPresentationCurrentContext];
[backgroundViewController presentViewController:_myMoreAppsViewController animated:NO completion:nil];

in iOS 8, you have to do this:

backgroundViewController.providesPresentationContextTransitionStyle = YES;
backgroundController.definesPresentationContext = YES;
[overlayViewController setModalPresentationStyle:UIModalPresentationOverCurrentContext];

arrow
arrow
    全站熱搜

    pcwiki 發表在 痞客邦 留言(0) 人氣()