【问题标题】:How To Create Custom view That looks like Alert View?如何创建看起来像警报视图的自定义视图?
【发布时间】:2017-04-19 13:58:03
【问题描述】:

我正在创建一个看起来像警报视图的自定义 uiview 控件。 我的自定义控件上有用户 RKRichtexteditor。 我无法在警报控件中添加我的视图,因为警报控件的大小是固定的。

我的问题是

当我按下按钮时,我的自定义视图将像警报视图一样显示。 我已经完成了使用模糊效果, 我面临一个问题。 我的问题是我的标签栏不模糊。

图片

Code is
=======
self.view.backgroundColor = [UIColor clearColor];

    self.blureEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    self.visualEffectView = [[UIVisualEffectView alloc] initWithEffect:self.blureEffect];
    self.visualEffectView.frame = self.view.bounds;
    self.visualEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [self.view addSubview:self.visualEffectView];

当我的自定义控件打开时如何模糊我的标签栏。 请帮助我或给我任何链接。

提前谢谢你。

【问题讨论】:

  • 但不想使用 UIAlert 视图,这是我的情况。
  • 目前 UIAlertView 已被弃用(因此您无论如何都不能使用它)并且应该使用 UIAlertController。无法对UIAlertController 进行大量自定义。
  • 请您再次阅读问题,我不想使用 Uialert 视图或 UIAlertController 对于我的具体要求,谢谢

标签: ios objective-c


【解决方案1】:

使用这个。

    self.blureEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    self.visualEffectView = [[UIVisualEffectView alloc] initWithEffect:self.blureEffect];
    self.visualEffectView.frame = self.view.bounds;
    self.visualEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [[[UIApplication sharedApplication] keyWindow] addSubview:self.visualEffectView];

【讨论】:

  • 让我检查一下,谢谢
  • 只需更改“self.visualEffectView.frame = self.view.bounds;” "self.visualEffectView.frame = [UIScreen mainScreen].bounds];"
  • :-不工作,它显示了我的两个额外按钮,它们位于标签栏的顶部。谢谢
  • :它模糊了所有内容,包括我的自定义视图和标签栏。 :(
  • 谢谢让我检查一下
猜你喜欢
  • 1970-01-01
  • 2011-02-05
  • 1970-01-01
  • 2017-11-16
  • 1970-01-01
  • 1970-01-01
  • 2014-06-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多