Search code examples
bundlepreferencestheostweak

Add a button to open an URL (Preferences Bundle)


I'm trying to add a button in my Preferences Bundle to open an URL in Safari (or in the Pref Bundle).

I'm looking this: https://github.com/hbang/NotiQuiet/blob/master/prefs/ADNQListController.m But I don't understand the else, if eccc...

I want just a button (for example "My website") that open www.mywebsite.com

Thanks all!


Solution

  • Add the following dictionary to your preferences plist:
    { action = link; cell = PSButtonCell; label = "Google"; }

    And the following method to your bundle:
    - (void)link { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"]]; }