【问题标题】:Presenting UIViewController with clear background以清晰的背景呈现 UIViewController
【发布时间】:2016-06-28 05:23:36
【问题描述】:

我正在为 Kony 应用程序编写 iOS FFI 方法。在那,我展示了一个具有清晰背景色的视图控制器。但是,它显示了一个白色背景视图。我没有使用故事板,我只是在代码中设计视图。在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 的新手,我该如何解决这个问题?

谁能帮我解决这个问题?

【问题讨论】:

  • 你在使用故事板吗?
  • @BhavinRamani,不,我只在代码中设计视图。在 newviewcontroller viewdidload 中,我将 self.view 背景颜色设置为 clearcolor
  • 好的。然后请用上述评论编辑您的问题。
  • @BhavinRamani,已编辑...
  • 尝试 newVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;

标签: ios objective-c uiviewcontroller presentmodalviewcontroller temenos-quantum


【解决方案1】:

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

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

【讨论】:

  • 我正在使用 KonyUIContext...,
  • 而不是 self.modalPresentationStyle,将 newVC.modalPresentationStyle 设置为 UIModalPresentationOverCurrentContext 就可以了
【解决方案2】:

试试这个,你只需要设置 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];

希望对您有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-23
    • 1970-01-01
    • 2021-10-26
    相关资源
    最近更新 更多