gpt4 book ai didi

iOS 11 公测版 9 : UITextField textcolor can't be changed when no keyboard

转载 作者:可可西里 更新时间:2023-11-01 05:42:57 25 4
gpt4 key购买 nike

我正在开发一个需要更改 UITextfield 的文本颜色的应用程序。我为此编写了以下代码。

-(IBAction)changedSegment:(UISegmentedControl *)segment{
UIColor *color = arrColors[segment.selectedSegmentIndex];
txtDemo.textColor = color;
}

它在 iOS 10 中运行良好。但在 iOS 11 beta 9 中,当键盘被隐藏时(从响应器中退出),文本颜色无法更改。

最佳答案

只需添加

[txtDemo setNeedsLayout];

关于iOS 11 公测版 9 : UITextField textcolor can't be changed when no keyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46178078/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com