How to always visible scroller of Tableview in Obj c?

前端 未结 6 949
春和景丽
春和景丽 2020-12-19 02:55

I want to show user there is a more content below but UITableView only shows scroll indicator when we scroll the tableview. There is any way, so I can show scroll indicator

6条回答
  •  臣服心动
    2020-12-19 03:46

    I got Solution for this question .
    Implement UIImageView

    @implementation UIImageView (UIScrollView)
        - (void) setAlpha:(float)alpha {
    
            if (self.superview.tag == noDisableVerticalScrollTag) {
                if (alpha == 0 && self.autoresizingMask == UIViewAutoresizingFlexibleLeftMargin) {
                    if (self.frame.size.width <10 && self.frame.size.height > self.frame.size.width) {
                        UIScrollView *sc = (UIScrollView*)self.superview;
                        if (sc.frame.size.height < sc.contentSize.height) {
                            return;
                        }
                    }
                }
            }
    
            if (self.superview.tag == noDisableHorizontalScrollTag) {
                if (alpha == 0 && self.autoresizingMask == UIViewAutoresizingFlexibleTopMargin) {
                    if (self.frame.size.height <10 && self.frame.size.height < self.frame.size.width) {
                        UIScrollView *sc = (UIScrollView*)self.superview;
                        if (sc.frame.size.width < sc.contentSize.width) {
                            return;
                        }
                    }
                }
            }
    
            [super setAlpha:alpha];
        }
        @end
    

    And Set tag Tableview or Scrollview Like

    #define noDisableVerticalScrollTag 97240626 //for visible only vertical scrollIndicator.
    #define noDisableHorizontalScrollTag 9898460 // for visible only Horizontal scrolling.
    

    and for Tableview [tableView flashScrollIndicators]; and scrollview [[scrollobj flashScrollIndicators]]; Thanks .

提交回复
热议问题