How to programmatically replace UIToolBar items built in IB

后端 未结 8 894
我在风中等你
我在风中等你 2020-12-13 21:35

I have a toolbar with various image buttons, created in Interface Builder.

I\'d like to be able to programmatically replace one of the buttons with an activity indic

8条回答
  •  鱼传尺愫
    2020-12-13 22:35

    I think it should be possible. You might either try creating an IBOutlet for that specific button in your ViewController class, and connect the button from IB to that outlet, or you can use the items property of that UIToolbar instance (you do have a reference to that, don't you?) and find the appropriate item in there, create a new NSArray with modified items, and set it back on that toolbar.items property.

    HTH

提交回复
热议问题