문제

This question already has an answer here:

I have a UIButton which I've added in IB, however the view behind this button changes color and I need to switch the button's type between InfoDark and InfoLight. Bizarrely though, buttonType property is read only. So how can i switch between light and dark info buttons?

도움이 되었습니까?

해결책

There's no way to change the .buttonType once it's set.

You can prepare two buttons, and hide one of them depending on the background color.

다른 팁

You can't set buttonType readonly property, use below may help:

UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top