我有一个带有WindowChrome对象的窗口和一个充满按钮的UserControl
class Blog: NSObject, NSCoding {
var blogName: String
var blogStatus1: String
var blogStatus2: String
var blogURL: String
var blogID: String
var blogType: String
var blogDate: String
var blogPop: String
private init (name: String,status1: String,status2: String,url: String,id: String,type: String,date: String,pop: String) {
blogName = name
blogStatus1 = status1
blogStatus2 = status2
blogURL = url
blogID = id
blogType = type
blogDate = date
blogPop = pop
super.init()
}
convenience init?(jsonObject: [String:Any]) {
guard let bID = jsonObject["id"] as? String,
let bName = jsonObject["blogName"] as? String,
let bStatus1 = jsonObject["blogStatus1"] as? String,
let bStatus2 = jsonObject["blogStatus2"] as? String,
let bURL = jsonObject["blogURL"] as? String,
let bType = jsonObject["blogType"] as? String,
let bDate = jsonObject["blogDate"] as? String,
let bPop = jsonObject["blogPop"] as? String
else {
print("Error: (Creating Blog Object)")
return nil
}
self.init(name: bName, status1: bStatus1, status2: bStatus2, url: bURL, id: bID, type: bType, date: bDate, pop: bPop)
}
convenience required init?(coder aDecoder: NSCoder) {
guard let blogName = aDecoder.decodeObject(forKey: "blogName") as? String,
let blogStatus1 = aDecoder.decodeObject(forKey: "blogStatus1") as? String,
let blogStatus2 = aDecoder.decodeObject(forKey: "blogStatus2") as? String,
let blogURL = aDecoder.decodeObject(forKey: "blogURL") as? String,
let blogID = aDecoder.decodeObject(forKey: "blogID") as? String,
let blogType = aDecoder.decodeObject(forKey: "blogType") as? String,
let blogDate = aDecoder.decodeObject(forKey: "blogDate") as? String,
let blogPop = aDecoder.decodeObject(forKey: "blogPop") as? String else {
print("Error: (Creating Blog Object)")
return nil
}
self.init(name: blogName, status1: blogStatus1, status2: blogStatus2, url: blogURL, id: blogID, type: blogType, date: blogDate, pop: blogPop)
}
func encode(with aCoder: NSCoder) {
aCoder.encode(blogName, forKey: "blogName")
aCoder.encode(blogStatus1, forKey: "blogStatus1")
aCoder.encode(blogStatus2, forKey: "blogStatus2")
aCoder.encode(blogURL, forKey: "blogURL")
aCoder.encode(blogID, forKey: "blogID")
aCoder.encode(blogType, forKey: "blogType")
aCoder.encode(blogDate, forKey: "blogDate")
aCoder.encode(blogPop, forKey: "blogPop")
}
}
我希望有一个漂亮的无边框窗口,同时保持易于控制的大小。
如何将按钮放在调整大小对话框上方?
答案 0 :(得分:0)
听起来您只需要将此属性添加到按钮中:
0xff