1
var textF2 = UITextField()
textF2.borderStyle = UITextBorderStyle.None
textF2.frame.size = CGSizeMake(200, 200)
textF2.text = self.textField.text
textF2.backgroundColor = UIColor.whiteColor()

self.textField.inputAccessoryView = textF2

textF2's height refuses to be set properly, atleast in terms of its appearance.

println(textF2.frame.size.height)

gives me the new value of 200 however it does not appear in the simulator that way.

Does inputAccessoryView cause problems related to setting the height?

var textF2 = UITextField()
textF2.borderStyle = UITextBorderStyle.None
textF2.frame = CGRectMake(50, 50, 200, 200)
textF2.text = self.textField.text
textF2.backgroundColor = UIColor.whiteColor()
self.view.addSubview(textF2)

does in fact give me proper appearance, so

self.textField.inputAccessoryView = textF2

is the problem. Does anybody know why?

modusCell
  • 13,151
  • 9
  • 53
  • 80

1 Answers1

1

inputAccessoryView is just a normal UIView underneath so to position it correctly you should set the frame always, setting only the size will have no effect.

Also, take in mind, that after the object became first responder any changes to the inputAccessoryView should be followed by a call to reloadInputViews otherwise they will not have any effect.

Stas Zhukovskiy
  • 799
  • 9
  • 21