Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么 ShazamTopView 只使用 userInteractionViews.first 响应事件?既然只用第一个,传 array 的意义是什么? #10

Closed
wujingcheng7 opened this issue Apr 19, 2022 · 2 comments

Comments

@wujingcheng7
Copy link

`//
// ShazamTopView.swift
// Shazam
//
// Created by bawn on 2019/1/24.
// Copyright © 2019 bawn. All rights reserved.
//

import UIKit

public class ShazamTopView: UIView {
....// 省略若干

override public func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
    ...// 省略若干
    var frames = [CGRect]()
    userInteractionViews.forEach { (item) in
        let frame = convert(item.frame, to: self)
        frames.append(frame)
    }
    for item in frames {
        let value = item.contains(point)
        return value // 为什么这里第一个就直接 return 了,既然如此,传一个数组的意义是什么?为什么不直接传一个 UIView 对象?
    }
    return false
}

}
`

@bawn
Copy link
Owner

bawn commented Apr 20, 2022

这里确实有问题,已经修复了

@bawn bawn closed this as completed in b7b22a4 Apr 20, 2022
@wujingcheng7
Copy link
Author

谢谢,给大佬点赞👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants