呈现具有清晰背景的UIViewController

时间:2016-06-28 05:23:36

标签: ios objective-c uiviewcontroller presentmodalviewcontroller kony

我正在为Kony应用程序编写iOS FFI方法。在那里,我提出了一个具有清晰backgroundcolor的viewcontroller。但是,它显示的是白色背景视图。我没有使用storyboars,我只是在代码中设计视图。在newviewcontroller viewdidload中,我将self.view背景颜色设置为clearcolor。

这是我尝试过的,

NewViewController *newVC = [[NewViewController alloc]init];
newVC.providesPresentationContextTransitionStyle = YES;
newVC.definesPresentationContext = YES;
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[KonyUIContext onCurrentFormControllerPresentModalViewController:newVC animated:YES];

我是KonyUIContext的新手,我该如何解决这个问题?

有人可以帮我吗?

2 个答案:

答案 0 :(得分:1)

试试这段代码......它对我来说非常适合......

MyViewController *modalViewController = [[MyViewController alloc] init];
modalViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;           
[KonyUIContext presentViewController:modalViewController animated:YES completion:nil];

答案 1 :(得分:0)

试试这个,你只需要设置backgroundcolor来清除viewcontroller视图的颜色。

NewViewController *newVC = [[NewViewController alloc]init];
newVC.view.backgroundColor = [UIColor clearColor];
newVC.providesPresentationContextTransitionStyle = YES;
newVC.definesPresentationContext = YES;
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[KonyUIContext onCurrentFormControllerPresentModalViewController:newVC animated:YES];

希望这有帮助!