Launch URL directly from launcher view

22 views
Skip to first unread message

Jonathan Malott

unread,
Aug 28, 2014, 1:37:56 PM8/28/14
to mylau...@googlegroups.com
Hello, no questions from me, but I thought I would share something you might find useful. I wanted to launch a URL in safari on iOS devices directly from the launcher view. Here is a quick and dirty way to do so. 

In MyLauncherViewController.m, find the launcherViewItemSelected method, and at the top of the method before all of the other code, add this:

    if ([item.controllerTitle rangeOfString:@"http"].location != NSNotFound) {

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:item.controllerTitle]];

        return;

    }


THEN, create an icon in your rootviewcontroller like normal. It doesn't matter what target you set it for, but have the title be the url you want to go to, and it will launch it in safari, like so:

 [[MyLauncherItem alloc] initWithTitle:@"Advertise"

                                                                iPhoneImage:@"itemImage"

                                                                  iPadImage:@"itemImage-iPad"

                                                                     target:@"doesntmatter"

                                                                targetTitle:@"http://www.facebook.com"

                                                                  deletable:NO]


Hope this helps, I can help with questions.


Reply all
Reply to author
Forward
0 new messages