iphone - 将自定义 View 添加到窗口并模糊背景 View ,并且不允许单击背景 View

标签 iphone ios

你好,我自定义了一个290*280的 View ,就像一个对话框,一切都可以,但是我的自定义 View 后面的其他 View 可以单击,我希望当我的自定义 View 弹出时其他 View 可以单击,我也想要窗口我的自定义 View 后面的内容是模糊的。

我的代码是:

#import <UIKit/UIKit.h>

@interface RecordView :UIView


@property (strong, nonatomic) IBOutlet UIButton *confirmBu;
@property (strong, nonatomic) IBOutlet UIButton *playBu;
@property (strong, nonatomic) IBOutlet UIButton *recrodBu;
@property (strong, nonatomic) IBOutlet UIButton *closeBu;


@property (strong, nonatomic) IBOutlet UIImageView *backgroundImageview;
@property (strong, nonatomic) IBOutlet UIImageView *showImageview;

-(void)setViewStyle;
@end

 #import "RecordView.h"

    @interface RecordView ()

    @end

    @implementation RecordView

    @synthesize confirmBu;
    @synthesize playBu;
    @synthesize recrodBu;
    @synthesize closeBu;



    @synthesize backgroundImageview;
    @synthesize showImageview;



    -(void)setViewStyle{

         self.frame=CGRectMake(15,100, 290, 280);
         self.backgroundColor=[UIColor clearColor];

        backgroundImageview.layer.masksToBounds=YES;
        backgroundImageview.layer.cornerRadius=15.0;
        backgroundImageview.layer.borderWidth=4.0;
        backgroundImageview.layer.borderColor=[[UIColor lightGrayColor] CGColor];

    }

    @end

self.recordDialog= [[[NSBundle mainBundle] loadNibNamed:@"RecordView" owner:self options:nil]lastObject];
                [self.recordDialog setViewStyle];
  [delegate.window addSubview:self.recordDialog];

最佳答案

另一种方法是以编程方式创建当前屏幕的屏幕截图。使用类似 https://github.com/tomsoft1/StackBluriOS 来模糊屏幕截图然后将该图像设置为背景。当您单击关闭按钮时,您所要做的就是再次隐藏背景图像。

关于iphone - 将自定义 View 添加到窗口并模糊背景 View ,并且不允许单击背景 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14578851/

相关文章:

ios - xCode 升级缺少模拟器。如何使用本地存储的模拟器?

ios - 在 ios 中调用嵌套的 json 对象

iphone - 为什么在 iPhone 应用程序中调用 glMatrixMode(GL_PROJECTION) 会给我 EXC_BAD_ACCESS ?

ios - 我可以更改 NSLayoutConstraint 的 multiplier 属性吗?

iphone - 使用 GCD 执行 sudzc Web 服务

IOS swift 如何用返回的 Json 数据填充我的 TableView

ios - 如何使用 UIImageJPEGRepresentation(_) -> NSData 压缩的 swift 解压 jpeg?

iPhone SDK : URL request not timing out

ios - 如何转换位置 : [CLLocation] to Coordinate2D?

iphone - SA_OAuthTwitterEngine 无法在我的时间轴上发布消息