1
我遇到了一個問題,我有一個uiview在底部,我需要添加一些標籤,我想保持靜態。然後,我在uiview的頂部添加一些可滾動內容的滾動視圖。最後,我將原始uiview設置爲表頭headerView。即使正確的contentSize,scrollView也不會滾動。UIScrollView裏面UIView設置爲tableHeaderView不滾動
UIView *header=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 100*objects.count, 150)];
[header setBackgroundColor:[UIColor redColor]];
//set up scroll view
UIScrollView *scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 20, 100*objects.count, 110)];
scrollView.delegate=self;
scrollView.contentSize=CGSizeMake(100*objects.count, scrollView.frame.size.height);
[scrollView setUserInteractionEnabled:YES];
[scrollView setScrollEnabled:YES];
[header addSubview:scrollView];
[scrollView setShowsHorizontalScrollIndicator:YES];
[self.tableView setTableHeaderView:header];
//add stuff to scroll view
然而,當我只設置滾動視圖作爲tableHeaderView,滾動完美的作品
[self.tableView setTableHeaderView:scrollView];
任何人都可以建議我怎麼可以設置原來鈕的UIView作爲標題視圖,並有滾動視圖仍然工作?
你能後的截圖,所以我們可以得到更好的主意嗎? – 2013-03-12 15:56:40
除了滾動視圖沒有滾動 – Live2Enjoy7 2013-03-12 16:58:51
可能是一個邊界問題沒有真正看到。 – Avigit 2013-03-12 17:14:56