我正在尝试自定义我的UITextField
。我已将拐角处的转弯并将情节提要中的textField边框设置为none。我对其进行了编码,以便在点击textField时,textField背景变为白色,边框变为灰色。但是,当我运行该应用程序时,textField边框会覆盖光标。
func textFieldDidBeginEditing(_ textField: UITextField) {
// Change the background color for the textField and change the border width for the textField.
textField.backgroundColor = UIColor.white
textField.layer.borderWidth = 2
textField.layer.borderColor = #colorLiteral(red: 0.9373082519, green: 0.9373301864, blue: 0.9373183846, alpha: 1)
// Disable the doneButton while editing.
doneButton.isEnabled = false
}
func textFieldDidEndEditing(_ textField: UITextField) {
// Change the background color for the textField and change the border width for the textField.
textField.backgroundColor = #colorLiteral(red: 0.9373082519, green: 0.9373301864, blue: 0.9373183846, alpha: 1)
textField.layer.borderWidth = 0
// Enable the doneButton when finished editing.
doneButton.isEnabled = true
// Set the title of the navigation bar to the text from the titleTextField.
if titleTextField.text != "" {
navigationItem.title = titleTextField.text
}
}
答案 0 :(得分:1)
当我想要填充时,我只对UITextField使用自定义类。
Traceback (most recent call last):
File "/Users/.py", line 14, in <module>
print([b.text for b in soup.select('#tournamentTable td[xodd]')])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/bs4/element.py", line 1376, in select
return soupsieve.select(selector, self, namespaces, limit, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/soupsieve/__init__.py", line 114, in select
return compile(select, namespaces, flags, **kwargs).select(tag, limit)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/soupsieve/__init__.py", line 63, in compile
return cp._cached_css_compile(pattern, namespaces, custom, flags)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/soupsieve/css_parser.py", line 214, in _cached_css_compile
CSSParser(pattern, custom=custom_selectors, flags=flags).process_selectors(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/soupsieve/css_parser.py", line 1113, in process_selectors
return self.parse_selectors(self.selector_iter(self.pattern), index, flags)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/soupsieve/css_parser.py", line 946, in parse_selectors
key, m = next(iselector)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/soupsieve/css_parser.py", line 1100, in selector_iter
raise SelectorSyntaxError(msg, self.pattern, index)
File "<string>", line None
soupsieve.util.SelectorSyntaxError: Invalid character '\x1b' position 17
line 1:
#tournamentTable td[xodd]
^
...