我遇到过这个问题,我似乎无法在网上找到答案。基本上我尝试做的是以编程方式创建UIToolbar
,其中包含UIBarButtonItems
个UIToolbar
。
我已完成的工作(如下所述)是创建UIToolbar
,然后将UIBarButtonItems
的项目设置为包含我想要的所有UIToolbar
的数组。 / p>
不幸的是,虽然显示了UIBarButtonItems
,但class DrawViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
//create bar buttons
let deleteBarButton = UIBarButtonItem(image: UIImage(named: "greyDelete"), style: .Plain, target: self, action: "deleteView:")
let eraseBarButton = UIBarButtonItem(image: UIImage(named: "greyErase"), style: .Plain, target: self, action: "erase:")
let resizeBarButton = UIBarButtonItem(image: UIImage(named: "greyResize"), style: .Plain, target: self, action: "resize:")
let viewBarButton = UIBarButtonItem(image: UIImage(named: "greyView"), style: .Plain, target: self, action: "view:")
let colorBarButton = UIBarButtonItem(image: UIImage(named: "greyColor"), style: .Plain, target: self, action: "color:")
let drawBarButton = UIBarButtonItem(image: UIImage(named: "greyDraw"), style: .Plain, target: self, action: "draw:")
let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: self, action: nil)
//set up toolbar
let toolbarItems = [deleteBarButton, flexibleSpace, eraseBarButton,
flexibleSpace, resizeBarButton, flexibleSpace,
viewBarButton, flexibleSpace, colorBarButton,
flexibleSpace, drawBarButton]
let toolbar = UIToolbar(frame: CGRectMake(0, view.bounds.height*0.93, view.bounds.width, view.bounds.height*0.7))
toolbar.barTintColor = UIColor(patternImage: UIImage(named: "blueToolbar")!)
toolbar.setItems(toolbarItems, animated: true)
self.view.addSubview(toolbar)
}
还没有显示出来
非常感谢有关为何发生这种情况的任何建议或解释!
var GroupDetailObject = Parse.Object.extend("Group_Detail");
var query = new Parse.Query(GroupDetailObject);
for (ss = 1; ss < groups.length; ss++) {
var tempQuery = new Parse.Query(GroupDetailObject);
tempQuery.equalTo("groupId", {
__type: "Pointer",
className: "Groups",
objectId: groups[ss].objectId
});
query = Parse.Query.or(query, tempQuery);
}