Ableton / LinkKit

iOS SDK for Ableton Link, a new technology that synchronizes musical beat, tempo, and phase across multiple applications running on one or more devices.
http://ableton.github.io/linkkit
Other
147 stars 10 forks source link

Can't find way to dismiss ABLLinkSettingsViewController #40

Closed seriouscyrus closed 6 years ago

seriouscyrus commented 6 years ago

I'm trying to implement the ABLLinkSettingsViewController through a popover on the iPhone and can't figure out the way to do it.

In the docs, there is a "Done" button in the top right which doesn't appear in my implementation.

Here is my code to present the view controller

- (IBAction)abletonLinkButtonAction:(id)sender {
    AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
    ABLLinkSettingsViewController *abletonLinkSettingsView = [ABLLinkSettingsViewController instance:delegate.abletonLinkSession];

    // Popover
    abletonLinkSettingsView.modalPresentationStyle = UIModalPresentationPopover;
    UIPopoverPresentationController *popover =  abletonLinkSettingsView.popoverPresentationController;
    popover.sourceView = self.view;
    popover.sourceRect = self.abletonLinkButton.frame;

    [self presentViewController:abletonLinkSettingsView animated:YES completion:nil];
}
![simulator screen shot 17 aug 2017 20 33 39](https://user-images.githubusercontent.com/2111315/29427852-67cd2602-838b-11e7-8a06-dcff44553a83.png)

And the attached image is the result

seriouscyrus commented 6 years ago

Never mind, I hand't looked at the demo. It needs to be embedded in a navigation controller

designerfuzzi commented 5 years ago

and the (id)sender needs to conform to UIPopoverController protocol which is object of changes/deprecated the moment. When using subclasses of UIButton as sender in example, the navigationController would hide the settings view but show the Title and maybe the Done button if placed. In comparison to CABTMIDICentralViewController and CABTMIDILocalPeripheralViewController where this would work had to specifically use UIButton to get it working properly. Maybe worth mentioning in the LinkKit documentation unless its working like the those both Bluetooth settings i.e.

fgo-ableton commented 5 years ago

I believe UIPopoverController is deprecated in favor of UIPopoverPresentationController. I see how that functionality could be useful. But might also limit other use cases. So I don't think it should be a requirement. It should be possible to wrap ABLLinkSettingsViewController in a UIPopoverPresentationController though.

designerfuzzi commented 5 years ago

Yes it can be wrapped and works when the sender is an UIButton with no subclassing, extension etc. And that is where the ABLLinkSettingsVC is different from CABTMidiCentralVC. Thats not a huge problem, but should be documented or in example code -(IBAction)showAbletonLinkSettingsPopOver(id)sender{} should be (UIButton*)sender{} then..