如何使用setTitleTextAttributes:forState:在UIBarItem中iOS?
你怎么设置的NSDictionary?不能使它工作,文档不是很清楚.
从文档:
setTitleTextAttributes:forState:
Run Code Online (Sandbox Code Playgroud)
设置给定控件状态的标题文本属性:
- (void)setTitleTextAttributes:(NSDictionary *)attributes
forState:(UIControlState)state
Run Code Online (Sandbox Code Playgroud)
参数:
attributes:包含文本属性的键值对的字典.您可以使用NSString UIKit Additions Reference中列出的键指定字体,文本颜色,文本阴影颜色和文本阴影偏移.
state:要为其设置标题文本属性的控件状态.
我对SettingWithCopyWarning有基本的了解,但是我无法弄清楚为什么我收到此特定情况的警告。
我正在遵循https://github.com/ageron/handson-ml/blob/master/02_end_to_end_machine_learning_project.ipynb中的代码
当我运行以下代码(使用.loc)时,没有得到SettingWithCopyWarning
但是,如果我改为使用.iloc运行代码,则会收到警告。
有人可以帮我理解吗?
from sklearn.model_selection import StratifiedShuffleSplit
split = StratifiedShuffleSplit(n_splits=1, test_size=0.2, random_state=42)
for train_index, test_index in split.split(housing, housing["income_cat"]):
strat_train_set = housing.loc[train_index]
strat_test_set = housing.loc[test_index]
for set_ in (strat_train_set, strat_test_set):
set_.drop("income_cat", axis=1, inplace=True)
Run Code Online (Sandbox Code Playgroud)