Incompatible pointer types initializing 'UIButton *' with an expression of type 'UIView'

xib に view - viewButton を設置

viewButton へ UIButton を 1 個設置

このボタンのレイアウトをコードで変更するときに

from のコードを書くと表題のエラーが出る

ので、to にすればよい

from

UIView *buttonView = self.viewButton.subviews[0]

to

UIView *buttonView = (UIButton *)self.viewButton.subviews[0]

理由

参考から引用

The problem is that viewWithTag: returns a UIView
because it can be of any subclass of UIView, including UIButton.

参考

stackoverflow.com

大切な何かを失ってしまった気がする (C 言語 # キャスト)