我在inputAccessoryView
中为UITextView
创建了viewDidLoad
:
var keyBoardToolBar:UIToolbar = UIToolbar(frame:CGRectMake(0,0,self.view.frame.size.width,50)) keyBoardToolBar.barStyle = UIBarStyle.Default
var firstButton: UIBarButtonItem = UIBarButtonItem(title: "firstButton", style: UIBarButtonItemStyle.Plain, target: self, action: Selector("firstButtonAction"))
var flexSpace = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FlexibleSpace, target: nil, action: nil)
var done: UIBarButtonItem = UIBarButtonItem(title: "Done", style: UIBarButtonItemStyle.Done, target: self, action: Selector("doneButtonAction"))
var items = NSMutableArray()
items.addObject(firstButton)
items.addObject(flexSpace)
items.addObject(done)
keyBoardToolBar.items = items as [AnyObject]
keyBoardToolBar.sizeToFit()
self.tv.inputAccessoryView = keyBoardToolBar
我想更改其他功能中的firstButton
按钮文字(viewDidLoad
之后)。那我该怎么办?谢谢!
答案 0 :(得分:0)
var
firstButton: UIBarButtonItem
就在viewDidLoad
之前的课堂内,并更改其标题使用firstButton.title
。 :)