flypig
flypig

Reputation: 1259

setting alpha of UITextField inputAccessoryView does not work

The inputAccessoryView is shown successfully, but it is totally black.

    _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;

I am completely confused over this... can anyone explain why it happens?

Upvotes: 1

Views: 950

Answers (1)

Abhishek Singh
Abhishek Singh

Reputation: 6166

Use This method of UIColor on previous line instead of setting alpha:-

[UIColor  colorWithHue:saturation:brightness:alpha:];

Upvotes: 2

Related Questions