How to always visible scroller of Tableview in Obj c?

前端 未结 6 911
春和景丽
春和景丽 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:26
    - (void)viewWillAppear:(BOOL)animated
    {
        [self.tableView flashScrollIndicators];
    }
    

    This may help you in solving your problem

    0 讨论(0)
  • 2020-12-19 03:26

    Here is the piece of code works for me, add this code in viewDidAppear

    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
          self.tableView_service.flashScrollIndicators()
        }
    

    Happy Coding

    0 讨论(0)
  • 2020-12-19 03:30
    -(void)viewDidAppear:(BOOL)animated{
    
     timer = [NSTimer scheduledTimerWithTimeInterval:0.8 target:self selector:@selector(indicator:) userInfo:nil repeats:YES];
    
    }
    
    -(void)viewDidDisappear:(BOOL)animated{
           [timer invalidate];
    }
    
    -(void)indicator:(BOOL)animated{
          [tableViewer flashScrollIndicators];
        NSLog(@"asda");
    }
    

    Just blink the scrollbar

    0 讨论(0)
  • 2020-12-19 03:38

    I did it:) I'm programming in MonoDevelop, so I only describe the method:

    You have to make your own UITableView class. There you overload PerformSelector and do NOT call the base function of it, but call flashScrollIndicators if the name of the Selector is _notifyPopOverStoppedScrolling.

    Overload function ReloadData and there call flashScrollIndicators as well. Only at zooming it will disappear, but you can call flashScrollIndicators at zooming too.

    0 讨论(0)
  • 2020-12-19 03:40

    There's no way (that I know of) to permanently display the scrollbars. You can

    [tableView flashScrollIndicators]
    

    in -viewDidAppear: to shortly display the scrollbars when the view is shown.

    Also, if you have many entries, you might wanna consider showing the (alphabetic) section index at the right. To do that, define -sectionIndexTitlesForTableView in your UITableViewDataSource. Using tableView.sectionIndexMinimumDisplayRowCount you can define the minimum number of entries to display the section Index.

    0 讨论(0)
  • 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 .

    0 讨论(0)
提交回复
热议问题