2013-01-11 45 views
0

我無法讓我的uiscrollview水平滾動,這讓我瘋狂。我能夠垂直獲取它,但不能水平。我把它作爲「滾動」鏈接到IB,其餘的在我的viewDidLoad中完成。我只是試圖水平滾動8個迷你圖像。每個圖像爲160 X 97.UIScrollView橫向

有人可以告訴我爲什麼這不起作用嗎?代碼如下。 謝謝你這麼多

[self->scroll setScrollEnabled:YES]; 
[self->scroll setDelegate:self]; 

// [self->scroll setShowsHorizontalScrollIndicator:NO]; 
// [self->scroll setIndicatorStyle:UIScrollViewIndicatorStyleDefault]; scroll.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 
scroll.contentMode = UIViewContentModeScaleToFill; 
[self->scroll setContentSize:CGSizeMake(1300.0,50.0)]; 
[self.view addSubview:scroll]; 
scroll.backgroundColor= [UIColor orangeColor]; 

回答

0

你應該設置滾動框 這樣

self.scroll.frame = CGRectMake(0,0,320,50); 
+0

它仍然只是垂直滾動。還有其他建議嗎?謝謝 –

+0

scrollview.frame = CGRectMake(0,0,320,50); scrollview.bounces = YES; scrollview.pagingEnabled = YES; scrollview.showsHorizo​​ntalScrollIndicator = NO; scrollview.contentSize = CGSizeMake(1300,50); – iuser1969782