gpt4 book ai didi

ios - textInputBox.layer.borderColor 在代码中不起作用

转载 作者:行者123 更新时间:2023-11-28 21:57:42 24 4
gpt4 key购买 nike

//sample problem
myInputTextBox.layer.borderColor= CFBridgingRetain([UIColor grayColor]); //not working
myInputTextBox.layer.borderColor= [UIColor grayColor]; //implicit conversion, not working
myInputTextBox.layer.borderColor= (__bridge CGColorRef)([UIColor grayColor]);//not working

我度过了一段美好的时光。 application,myInputTextBox 是 UITextField 对象。请帮我解决 Xcode for IOS 中的这个问题

//Actual code is 
UITextField *_PI[6];
for(int i=0;i<totalChances;i++){
_PI[i]=[[UITextField alloc] initWithFrame:CGRectOffset(CGRectMake(15,55, 50,30), 49*i,0)];
_PI[i].placeholder=[NSString stringWithFormat:@"P(%c)",(i+'A')];
_PI[i].Delegate=self;
_PI[i].font=fontInputs;
_PI[i].borderStyle=UITextBorderStyleLine;
_PI[i].layer.borderWidth=0.5f;//even if i change the border width to 2.0, it does not work
_PI[i].layer.borderColor= (__bridge CGColorRef)([UIColor grayColor]);//this line doesn't works
[self.view addSubview:_PI[i]];
}

最佳答案

尝试设置边框宽度

 myInputTextBox.layer.borderWidth = 2.0f;

编辑:

将您的代码修改为:

    UITextField *_PI[6];
for(int i=0;i<totalChances;i++){
_PI[i]=[[UITextField alloc] initWithFrame:CGRectOffset(CGRectMake(15,55, 50,30), 49*i,0)];
_PI[i].placeholder=[NSString stringWithFormat:@"P(%c)",(i+'A')];
_PI[i].delegate=self; // you had 'd' capital
_PI[i].font=fontInputs;
_PI[i].borderStyle=UITextBorderStyleLine;
_PI[i].layer.borderWidth=5.5f;//even if i change the border width to 2.0, it does not work
_PI[i].layer.borderColor= [UIColor grayColor].CGColor;//this line doesn't works
[self.view addSubview:_PI[i]];
}

关于ios - textInputBox.layer.borderColor 在代码中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25983066/

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