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 在枚举上的区别导致的

    
    
    
    

  • 相关阅读:
    webpack 学习
    文件操作
    关于列表remove的操作和字符串split的操作新领悟
    深浅拷贝和基础类型补充
    小数据池和编码
    字典和集合
    列表和元组
    字符串理论
    递归遍历多层列表
    基本数据类型和操作
  • 原文地址:https://www.cnblogs.com/melons/p/5791981.html
Copyright © 2011-2022 走看看