1

にサブビューとして追加したUITextView名前付きのがあります。それ自体がのサブビューです:descriptionTextviewDescriptionsliderView

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です:

_sliderView = [[PTSlidersDimension alloc] initWithFrame:CGRectMake(350, 270, 390, 250)]

PTSliderDimensionは、UIViewから継承するカスタムクラスであることに注意してください。

4

4 に答える 4

1

Hermann Kleckerが述べたようにscrollEnabled、使用することができ、また試すことができます

_descriptionText.UserInteractionsEnabled =YES;
于 2012-12-13T11:17:33.553 に答える
1

追加

_descriptionText.scrollEnabled    = YES;
于 2012-12-13T11:09:34.920 に答える
1

あなたはどんなフレームを持っていますviewDescriptionか?おそらくそれはあなたのフレームよりも小さいdescriptionTextですか?

(両方ともscrollEnabledデフォルトuserInteractionEnabledでYESであるため、これは役に立ちません。)

于 2012-12-13T11:12:33.607 に答える
-1
_descriptionText.textAlignment                       =   NSTextAlignmentJustified;
    _descriptionText.showsVerticalScrollIndicator        =   false;
    _descriptionText.selectable                          =   false;
    _descriptionText.editable                            =   false;
于 2018-03-21T09:42:46.867 に答える