我有一个简单的集合视图测试(基于在线教程),它可以很好地独立运行。但是当我将它嵌入导航控制器时,它停止工作。我通过 (1) 创建一个 headerView(64 像素高)并将其添加到顶部的视图中来构建屏幕。(2) 我构建了一个集合视图并将其添加到 headerView。
这是代码:
import UIKit
class ViewController: UIViewController,
UICollectionViewDelegate, UICollectionViewDataSource,
UINavigationControllerDelegate
{
var collectionView : UICollectionView!
var topView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
var frame = CGRect(x:0,y:128, width:view.frame.width, height:64)
topView = UIView(frame:frame)
self.view.addSubview(topView)
// CollectionView
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
layout.sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
layout.itemSize = CGSize(width: 50, height: 50)
frame = CGRect(x: 0, y: 0, width: Int(self.topView.frame.width), height: Int(self.topView.frame.height))
collectionView = UICollectionView (frame: frame, …Run Code Online (Sandbox Code Playgroud) 我有一个函数编码为:
func deleteEnclosedString(s: String, startString s1:String, endString s2: String) -> String {
}
Run Code Online (Sandbox Code Playgroud)
我想创建一个class子类,String在其中我定义一个函数并使用如下:
var myString = "A [typical] string"
myString.deleteEnclosedString(startString: "[", endString: "]")
Run Code Online (Sandbox Code Playgroud) 我正在尝试切换到ionic2.在我之前安装的离子1上安装似乎成功(基于输出)但离子1仍然如离子信息所示.这是步骤.任何帮助,将不胜感激.