How to add image(s) to UIToolBar?

后端 未结 1 1221
故里飘歌
故里飘歌 2021-01-20 00:02

I\'d like to add an image to a UIToolBar that a user cannot interact with. It would essentially be just a non-interactive indicator, like a badge.

Is this possible?

1条回答
  •  广开言路
    2021-01-20 01:00

    Create an UIBarButtonItem with an Image and add it:

    Example:

    UIBarButtonItem* item = [[UIBarButtonItem alloc] initWithImage:yourImage style:UIBarButtonItemStyleBordered target:nil action:nil];
    

    If you don't want the button appearance, try to use:

    UIBarButtonItem* item = [UIBarButtonItem initWithCustomView:yourImageView];
    

    0 讨论(0)
提交回复
热议问题