我正在使用菜单和工作成功的iOS swift2应用程序。但我想将文本值更改为菜单项的字符串变量。我的代码在这里。
public class MediumMenuItem: NSObject {
public var title: String?
public var completion: completionHandler?
override private init() {
super.init()
}
public convenience init(title: String, completion: completionHandler) {
self.init()
self.title = title
self.completion = completion
}
}
我的导航控制器
let item2 = MediumMenuItem(title: "Link 1") {
let topStoriesViewController = storyboard.instantiateViewControllerWithIdentifier("Web1") as! WebViewController1
self.setViewControllers([topStoriesViewController], animated: false)
}
我想将 MediumMenuItem(标题:“链接1”)更改为喜欢;
MediumMenuItem(title:title1)//变量不是“link1”
感谢您的帮助。
TY
答案 0 :(得分:0)
我自己解决了:)
加
var title1 : String?
var title2 : String?
var title3 : String?
title1 = "Link 1";
title2 = "Link 2";
title3 = "Link 3";
let item2 = MediumMenuItem(title: title1!) {
谢谢:)