문제

I have a UIBarButton in a Navigation Bar (the VC is embedded within a Navigation Controller). In IB I set the button with an Identifier:

Bar Button in Navigation Bar Attributes Inspector

How do I set this Attribute from code?

도움이 되었습니까?

해결책

You should be able to set it like

UIBarButtonItem *trashButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:nil];

Check out the Apple Documentation for this here

Unfortunately, Apple only allow you to set this when you initialize the UIBarButtonItem there isn't a property to set this.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top