zoukankan      html  css  js  c++  java
  • 【iOS】swift-Binary operator '|' cannot be applied to two UIViewAutoresizing operands

    let view = UIView(frame: CGRect(x: 0, y: 0,  320, height: 568))
    addSubview(view)
    

    view.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight

    会报以下错误:

    Binary operator '|' cannot be applied to two UIViewAutoresizing operands

    更改为:

    view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
    即可解决
    但是在极光推送中遇到同样问题后,这样并不行
    
    原OC代码:

          [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |

                                                            UIUserNotificationTypeSound |

                                                            UIUserNotificationTypeAlert)

                                                categories:nil];

    转为swift
            JPUSHService.registerForRemoteNotificationTypes(UIUserNotificationType.Badge.rawValue | UIUserNotificationType.Sound.rawValue | UIUserNotificationType.Alert.rawValue, categories: nil)
    就是swift 和 OC 在枚举上的区别导致的

    
    
    
    

  • 相关阅读:
    CentOS 7 安装MySQL 5.7
    Introduction to BGP (4)
    Introduction to BGP (3)
    Introduction to BGP (2)
    Introduction to BGP (1)
    Cisco NAT Fundation
    Linux安装Nginx
    GRE协议学习与练习
    Oracle Study Note : Users and Basic Security
    Oracle Study Note : Tablespace and Data Files
  • 原文地址:https://www.cnblogs.com/melons/p/5791981.html
Copyright © 2011-2022 走看看