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

    
    
    
    

  • 相关阅读:
    Python 基于Python实现的ssh兼sftp客户端(上)
    lintcode: 最长连续序列
    lintcode:颜色分类
    lintcode: 堆化
    lintcode: 旋转图像
    lintcode: 寻找旋转排序数组中的最小值
    lintcode: 跳跃游戏 II
    lintcode:最小差
    华为:数独填充
    华为:字符集合
  • 原文地址:https://www.cnblogs.com/melons/p/5791981.html
Copyright © 2020-2023  润新知