我正在使用SQLite。
我有两个清单。 func initiateScrollView() {
//create scrollView with paging enabled
let scrollView = UIScrollView(frame: view.bounds)
scrollView.isPagingEnabled = true
scrollView.delegate = self
view.addSubview(scrollView)
//get page size
let pageSize = view.bounds.size
//three simple UIView are created (view1, view2, view3)
//array with individual views
let pagesViews = [view1, view2, view3]
//amount of views
let numberOfPages = pagesViews.count
//add subviews (pages)
for (pageIndex, page) in pagesViews.enumerated(){
//add individual pages to scrollView
page.frame = CGRect(origin: CGPoint(x:0 , y: CGFloat(pageIndex) * pageSize.height), size: pageSize)
scrollView.addSubview(page)
//add Subview with videoplayer frame to individual "pages"
let videoPlayerFrame = CGRect(x: 0, y: 0, width: pageSize.width, height: pageSize.height)
let videoPlayerView = PlayerView(frame: videoPlayerFrame)
page.addSubview(videoPlayerView)
}
//adjust size of scrollView
scrollView.contentSize = CGSize(width: pageSize.width, height: pageSize.height * CGFloat(numberOfPages))
}
,其中包含我的sql查询结果的标题,该结果仅包含两个值(最终列表的/列)和res1
,它是保存数据的列表(二维)。
如何将res2
列表分配给res
,然后立即追加/扩展/插入res1
列表,使其看起来像这样。
res2
等。
我试过,插入特定索引,扩展和其他。他们不工作。如果没有/循环迭代,我怎么能这样做?必须有这样的功能,或者做一些如此简单的事情。感谢。
答案 0 :(得分:1)
要么我不明白你的要求,要么答案非常简单:
res = [res1] + res2