开发者

Is it possible to access UIBarButtonItem using tag?

开发者 https://www.devze.com 2023-01-18 05:52 出处:网络
I hope t开发者_如何学Goo access UIBarButtonItem on an UIToolbar using tag. The codes show below UIBarButtonItem *myBarButtonItem=(UIBarButtonItem*)myUIToolBar.items[i];

I hope t开发者_如何学Goo access UIBarButtonItem on an UIToolbar using tag. The codes show below

UIBarButtonItem *myBarButtonItem=(UIBarButtonItem*)myUIToolBar.items[i];

but myBarButtonItem returns no object(0x0)


Here is the documentation from Apple:

The items displayed on the toolbar.

@property(nonatomic, copy) NSArray *items Discussion The items, instances of UIBarButtonItem, that are visible on the toolbar in the order they appear in this array. Any changes to this property are not animated. Use the setItems:animated: method to animate changes.

The default value is nil

Did you set the items array, can you print out the value of NSLog(@"%@", myToolBar.items); to see if it is nil and to see how many UIBarButtonItem inside

0

精彩评论

暂无评论...
验证码 换一张
取 消