eggswift / ESTabBarController

:octocat: ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie!
MIT License
5.17k stars 578 forks source link

Mouse cursor flies up to top when hovering ESTabBarItem #237

Closed shimastripe closed 1 year ago

shimastripe commented 4 years ago

I checked an example app in this repostiory. Please check.

test

iPad OS Supports mouse cursor. When hovering UITabBarItem, the cursor surrounds UITabBarItem. But in the case of ESTabBarItem, the cursor flies up.

conscientiousness commented 4 years ago

I use the following code to solve this problem.

class YourTabBarController: ESTabBarController {

    init() {
        super.init(nibName: nil, bundle: nil)

        if #available(iOS 13.4, *) {
            view.subviews.forEach({
                $0.addInteraction(UIPointerInteraction(delegate: self))
            })
            tabBar.addInteraction(UIPointerInteraction(delegate: self))
        }
    }
}

@available(iOS 13.4, *)
extension YourTabBarController: UIPointerInteractionDelegate {
    func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
        return nil
    }
}