我編程創建了一個UISCrollView,但我看不到滾動條/指標。UIScrollView無法看到滾動條/指標。
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];
此代碼我把它添加到其再裝上另一大的滾動型的視圖..有誰知道爲什麼是這樣的情況?也爲了簡化我已經每個拉布勒包含文本減少到的話,但在程序我有文本足以滾動
謝謝..
如果contentSize屬性設置正確,滾動條應該在滾動時可見。但我不認爲將scrollview作爲另一個滾動視圖的子視圖是一個好主意。 –
這是爲什麼?我有一個主scrollView和一個SubScrollView,我需要用於我的iPad應用程序。有沒有其他方法可以實現這一點? – CodeGeek123
也設置內容不正確的工作在我的情況下 – CodeGeek123