hxsxyz / QiSlider

一个带value text的自定义slider。
MIT License
12 stars 3 forks source link

ios14上获取不到slider上的滑块图层 #1

Open npzlxph0415 opened 4 years ago

VictDog commented 4 years ago

同上面问题

ZacharyIcoder commented 4 years ago
VictDog commented 4 years ago
  • (UIView )thumbView { if (!_thumbView && self.subviews.count > 2) { _thumbView = self.subviews[2]; } else { UIView view = self.subviews[0]; _thumbView = view.subviews[2]; } return _thumbView; }

实际运行下你会发现是崩溃的

ManBuTianYa commented 4 years ago

这样可以解决

qaz114158 commented 2 years ago
  • (UIView )thumbView { if (@available(iOS 14.0, )) {

    if (!_thumbView && self.subviews.count > 2) {
    
        [self layoutSubviews];
        UIView *view = self.subviews[2];
        if (view.subviews.count > 2) {
            _thumbView = view.subviews[2];
        }
    }

    }else {

    if (!_thumbView && self.subviews.count > 2) {
        _thumbView = self.subviews[2];
    }

    } return _thumbView; }

这样可以解决

ios15以上又不行了,不过我找到更好的方法

dabenliu commented 1 year ago
  • (UIView )thumbView { if (@available(iOS 14.0, )) {

    if (!_thumbView && self.subviews.count > 2) {
    
        [self layoutSubviews];
        UIView *view = self.subviews[2];
        if (view.subviews.count > 2) {
            _thumbView = view.subviews[2];
        }
    }

    }else {

    if (!_thumbView && self.subviews.count > 2) {
        _thumbView = self.subviews[2];
    }

    } return _thumbView; }

什么办法