ScrollView滑到 代码段

卫招
2023-12-01

 [self.logString appendFormat:@"%i - %@\n", self.index, bunchOfWords];

    

    [self.logTextView setText:self.logString];

    

    NSLog(@"%i - %@\r", self.index, bunchOfWords);

    

    CGFloat height, offset;

    height = self.logTextView.contentSize.height - self.logTextView.bounds.size.height;

    

    offset = self.logTextView.contentOffset.y;

    NSLog(@"height:%.f offset:%f.",height,offset);

    

    if (height == offset) {

        self.dragging = NO;

    }

    //

    if (!self.isDragging) {


        CGPoint p = [self.logTextView contentOffset];

        NSLog(@"%@",NSStringFromCGPoint(p));

        [self.logTextView setContentOffset:p animated:NO];

        [self.logTextView scrollRangeToVisible:NSMakeRange([self.logTextView.text length], 0)];

        [self.logTextView setScrollEnabled:NO];

        [self.logTextView setScrollEnabled:YES];

    

    }

 类似资料: