我有以下的問題,我已經創建廠景,滾動視圖包含的代碼添加的UIScrollView不滾動上述視圖2</p> <p>然後添加滾動視圖到VIEW1迅速
,我的滾動視圖不滾動的問題的一些UI元素和它的內容出現上述觀點2,而我需要它是它的後面,以便能夠滾動它
截圖以下
我加入UI元素的代碼如下
mainScrollView = UIScrollView(frame: CGRectMake(0, 0, self.view.frame.size.width, 1000))
let awesomeView2: UIImageView = UIImageView(frame: CGRectMake(0, 0, self.view.frame.size.width, 180))
awesomeView2.load(selectedItem.listingImage);
mainScrollView.addSubview(awesomeView2);
let title: UILabel = UILabel(frame: CGRectMake(0, 180, self.view.frame.size.width, 44));
title.text = selectedItem.listingTitle;
title.textAlignment = .Right;
mainScrollView.addSubview(title);
let catName: UILabel = UILabel(frame: CGRectMake(200, 224, 120, 21));
catName.text = selectedItem.catName
catName.textAlignment = .Right;
mainScrollView.addSubview(catName);
let datePublished: UILabel = UILabel(frame: CGRectMake(0, 224, 200, 21));
datePublished.text = selectedItem.dateCreated
datePublished.textAlignment = .Left
mainScrollView.addSubview(datePublished);
let grayColor = UIColor(red: 1, green: 165/255, blue: 0, alpha: 1)
let iconsView: UIView = UIView(frame: CGRectMake(0, 250, self.view.frame.size.width, 32));
iconsView.backgroundColor = grayColor
mainScrollView.addSubview(iconsView);
if (KhawaterDataManager.instance.banners.itemBanners.count > 0) {
let awesomeView3: UIImageView = UIImageView(frame: CGRectMake(0, 282, self.view.frame.size.width, 50))
awesomeView3.load(KhawaterDataManager.instance.banners.itemBanners[0].image);
mainScrollView.addSubview(awesomeView3);
}
// test
let catName1: UILabel = UILabel(frame: CGRectMake(0, 335, self.view.frame.size.width, 50));
catName1.text = selectedItem.catName
mainScrollView.addSubview(catName1);
let catName2: UILabel = UILabel(frame: CGRectMake(0, 385, self.view.frame.size.width, 50));
catName2.text = selectedItem.catName
mainScrollView.addSubview(catName2);
let catName3: UILabel = UILabel(frame: CGRectMake(0, 435, self.view.frame.size.width, 50));
catName3.text = selectedItem.catName
mainScrollView.addSubview(catName3);
mainScrollView.contentSize = CGSizeMake(self.view.frame.size.width, 1000)
mainScrollView.scrollEnabled = true;
mainView.addSubview(mainScrollView);
請誰能告訴我這裏有什麼問題嗎?