我有一个UITextView
命名descriptionText
的,我作为子视图添加到viewDescription
. 它本身是一个子视图sliderView
:
sliderView -> viewDescription -> descriptionText
出于某种原因,descriptionText
不会滚动。但是,如果我将它作为子视图添加到sliderView
,它会滚动...
这就是我创建的方式UITextView
:
_descriptionText = [[UITextView alloc] initWithFrame:CGRectMake(10, 30, 220, 100)];
_descriptionText.text = @"Some long text here...";
_descriptionText.backgroundColor = [UIColor clearColor];
_descriptionText.textAlignment = UITextAlignmentLeft;
_descriptionText.textColor = [UIColor whiteColor];
_descriptionText.font = [UIFont boldSystemFontOfSize:11];
_descriptionText.editable = NO;
请注意,我已经设置:
_viewDescription.userInteractionEnabled = YES;
我怎样才能让它工作?
编辑1:我也尝试了所有这些事情,但没有任何改进:
[_descriptionText setContentSize:CGSizeMake(500, 500)];
[_descriptionText setContentOffset:CGPointMake(200, 200)];
[_descriptionText setOpaque:TRUE];
[_descriptionText setEditable:NO];
[_descriptionText setShowsVerticalScrollIndicator:YES];
[_descriptionText setScrollEnabled:YES];
[_descriptionText setUserInteractionEnabled:YES];
编辑 2:这是 _viewDescription:
_viewDescription = [[UIView alloc] initWithFrame:CGRectMake( self.frame.size.width + 20, 110, 230, 140)];
这是自定义滑块视图:
_sliderView = [[PTSlidersDimension alloc] initWithFrame:CGRectMake(350, 270, 390, 250)]
请注意,PTSliderDimension 是继承自 UIView 的自定义类。