gpt4 book ai didi

xcode - 在 TableView 中更改页脚中按钮的按钮文本颜色

转载 作者:行者123 更新时间:2023-12-02 06:38:23 25 4
gpt4 key购买 nike

我有一个 UIView,我已将其制作成添加到我的表格 View 下方的按钮:

myUIView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 120,50)];
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];
[myButton setAutoResizingMask: [UIViewAutoResizingFlexibleWidth|UIViewAutoResizingFlexibleHeight];
[myButton setFrame:CGRectMake(20,0,80,40)];

myButton.titleLabel.textColor = [UIColor blackColor]; //Doesn't seem to work

[myButton setTitle:@"Test" forState:UIControlStateNormal];
myButton.titleLabel.font = [UIFont boldSystemFontOfSize:18];
[myButton setBackgroundImage:[[UIImage imageNamed:@"myImage.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0] forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(myAction:) forControlEvents:UIControlEventTouchUpInside];
[myUIView addSubView:myButton];

无论我尝试什么,字体似乎总是白色的。我该怎么做才能更改字体的颜色?

最佳答案

你想使用 setTitleColor: forState:

[myButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

关于xcode - 在 TableView 中更改页脚中按钮的按钮文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12959145/

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