UIScrollView ne peut pas voir ScrollBars / Indicators.

J'ai créé par programme un UISCrollView mais je ne peux pas voir les barres de défilement / indicateurs.

UIScrollView * contentScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(760, 70, 205, 320)]; contentScrollView.delegate = self; contentScrollView.scrollEnabled = YES; contentScrollView.pagingEnabled = YES; contentScrollView.userInteractionEnabled=YES; contentScrollView.scrollsToTop = YES; contentScrollView.showsVerticalScrollIndicator = NO; contentScrollView.showsVerticalScrollIndicator = YES; contentScrollView.alwaysBounceVertical = NO; contentScrollView.alwaysBounceHorizontal = NO; contentScrollView.bounces = NO; contentScrollView.hidden = NO; [contentScrollView flashScrollIndicators]; UILabel *titleLable = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 205, 40)]; UILabel *subtitleLable = [[UILabel alloc] initWithFrame:CGRectMake(10, 60, 205, 50)]; UITextView * mainContent = [[UITextView alloc]initWithFrame:CGRectMake(10, 110, 205, 230)]; [titleLable setText:@"...."]; [subtitleLable setText:@"SUbtitle"]; [mainContent setText:@"Descritpon"]; [contentScrollView addSubview:mainContent]; [contentScrollView addSubview:titleLable]; [contentScrollView addSubview:subtitleLable]; 

Ce code je l'ajoute à une vue qui est encore attachée à un autre scrollview plus grand. Est-ce que quelqu'un sait pourquoi c'est le cas? Aussi pour simplifier j'ai réduit le text chaque lable contient aux mots mais dans le programme j'ai le text est suffisant pour faire défiler

Merci..

Pour que l'affichage déroulant défile, la taille du contenu de la vue défilée doit être supérieure à ses limites. Veuillez append cette ligne, puis vérifiez:

 contentScrollView.contentSize=CGSizeMake(320, 250); 

et définissez également contentScrollView.bounces sur YES et supprimez la ligne contentScrollView.showsVerticalScrollIndicator=YES car vous avez d'abord défini la valeur sur NO puis sur YES .

Cela devrait faire le travail.

 contentScrollView.showsHorizontalScrollIndicator = YES; contentScrollView.showsVerticalScrollIndicator = YES;