NSTouchBar委托从未调用过

时间:2016-11-23 18:44:52

标签: objective-c macos nstouchbar

我尝试扩展支持触摸栏的应用程序,但从不调用触摸栏委托方法。 :

    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

0 个答案:

没有答案
相关问题