zoukankan      html  css  js  c++  java
  • 悬浮按钮

    @property(strong,nonatomic)UIWindow *window;

    @property(strong,nonatomic)UIButton *FloatBtn;

       _FloatBtn = [UIButton buttonWithType:UIButtonTypeCustom];

        [_FloatBtn setTitle:@"发布需求" forState:UIControlStateNormal];

        _FloatBtn.titleLabel.font = [UIFont fontWithName:@"Arial" size:12];

        _FloatBtn.frame = CGRectMake(0, 0, 60, 60);

        [_FloatBtn addTarget:self action:@selector(resignWindow) forControlEvents:UIControlEventTouchUpInside];

        

        _window = [[UIWindow alloc]initWithFrame:CGRectMake(SCREENWIDTH-90, SCREENHEIGHT-100, 60, 60)];

        _window.windowLevel = UIWindowLevelAlert+1;

        _window.backgroundColor = [UIColor colorwithHexString:@"#9d8a84"];

        _window.layer.borderWidth = 0.2;

        _window.layer.borderColor=[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.6].CGColor;

        //阴影的颜色

        _window.layer.shadowColor = [[UIColor blackColor] CGColor];

        _window.layer.shadowOffset = CGSizeMake(3, 3);

    //

    ////    _window.layer.backgroundColor=[UIColor blackColor].CGColor;

        _window.layer.shadowColor=[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.6].CGColor;

        _window.layer.shadowRadius=5;

    ////    _window.layer.shadowOffset=CGSizeMake(1, 1);

        _window.layer.shadowOpacity=0.3;

        

        _window.layer.cornerRadius = 30;

        _window.layer.masksToBounds = YES;

        [_window addSubview:_FloatBtn];

        [_window makeKeyAndVisible];//关键语句,显示window

    /**

     *  关闭悬浮的window

     */

    - (void)resignWindow

    {

        

        [_window resignKeyWindow];

        [_window setHidden:YES];

        _window = nil;

        //跳转页面

        DistrubuteViewController *dis = [[DistrubuteViewController alloc]init];

        [self.navigationController pushViewController:dis animated:YES];

        

    }

  • 相关阅读:
    Python之推导式笔记
    利用ShardingSphere-JDBC实现分库分表--配置中心的实现
    利用ShardingSphere-JDBC实现分库分表
    MGR安装记录
    学习RadonDB源码(三)
    学习RadonDB源码(二)
    学习RadonDB源码(一)
    Spring Cloud学习笔记--Spring Boot初次搭建
    一次单核CPU占用过高问题的处理
    MySQL AutoCommit带来的问题
  • 原文地址:https://www.cnblogs.com/liaolijun/p/5486359.html
Copyright © 2011-2022 走看看