inputAccessoryView
显示成功,但是它是完全黑色的。
_textField = [[UITextField alloc] initWithFrame: CGRectZero]; // update frame later
_textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
UIView *inputAccessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 180)];
inputAccessoryView.backgroundColor = [UIColor blackColor];
inputAccessoryView.alpha = 0.2;
_textField.inputAccessoryView = inputAccessoryView;
我对此完全感到困惑...谁能解释为什么会这样?
最佳答案
在上一行中使用此UIColor方法,而不是设置alpha:-
[UIColor colorWithHue:saturation:brightness:alpha:];
关于objective-c - 设置UITextField inputAccessoryView的Alpha不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10580845/