成功显示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;
我对此完全感到困惑......任何人都能解释为什么会这样吗?
答案 0 :(得分:2)
在前一行使用此UIColor方法,而不是设置alpha: -
[UIColor colorWithHue:saturation:brightness:alpha:];