A UIActivity subclass that opens URLs in Safari
Objective-C Ruby
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 27 commits behind davbeck:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
TUSafariActivity
TUSafariActivityExample.xcodeproj
TUSafariActivityExample
.gitattributes
.gitignore
LICENSE.md
README.md
SafariActivity.psd
TUSafariActivity.podspec

README.md

TUSafariActivity

TUSafariActivity is a UIActivity subclass that provides an "Open In Safari" action to a UIActivityViewController.

TUSafariActivity screenshot

Requirements

  • As UIActivity is iOS 6 only, so is the subclass.
  • This project uses ARC. If you want to use it in a non ARC project, you must add the -fobjc-arc compiler flag to TUSafariActivity.m in Target Settings > Build Phases > Compile Sources.

Installation

CocoaPods

pod 'TUSafariActivity'

Manually

Add the TUSafariActivity subfolder to your project. There are no required libraries other than UIKit.

Usage

(See example Xcode project)

Simply alloc/init an instance of TUSafariActivity and pass that object into the applicationActivities array when creating a UIActivityViewController.

NSURL *URL = [NSURL URLWithString:@"http://google.com"];
TUSafariActivity *activity = [[TUSafariActivity alloc] init];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[URL] applicationActivities:@[activity]];

Note that you can include the activity in any UIActivityViewController and it will only be shown to the user if there is a URL in the activity items.