我尝试扩展支持触摸栏的应用程序,但从不调用触摸栏委托方法。 :
static NSTouchBarCustomizationIdentifier SliderCustomizationIdentifier = @"com.myapp.sliderViewController";
static NSTouchBarItemIdentifier SliderItemIdentifier = @"com.myapp.slider";
@interface SliderViewController () <NSTouchBarDelegate>
@end
@implementation SliderViewController
//init touch bar is called
- (NSTouchBar *)makeTouchBar
{
NSTouchBar *bar = [[NSTouchBar alloc] init];
bar.delegate = self;
bar.customizationIdentifier = SliderCustomizationIdentifier;
// Set the default ordering of items.
bar.defaultItemIdentifiers =
@[SliderItemIdentifier, NSTouchBarItemIdentifierOtherItemsProxy];
bar.customizationAllowedItemIdentifiers = @[SliderItemIdentifier];
return bar;
}
//NEVER CALLED
- (nullable NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
{
}
@end
这是我的视图控制器的代码
UndertowFraction