Advertisement
Guest User

Untitled

a guest
May 27th, 2015
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <UIKit/UIKit.h>
  2.  
  3. %hook TestSettingsController
  4.  
  5. -(void)viewDidLoad {
  6.     %orig;
  7.  
  8.     UIBarButtonItem *shareButton = [[UIBarButtonItem alloc]
  9.                                initWithBarButtonSystemItem:UIBarButtonSystemItemAction
  10.                                target:self
  11.                                action:@selector(shareButtonTapped:)];
  12.     [[self navigationItem] setRightBarButtonItem:shareButton animated:NO];
  13. }
  14.  
  15. %new
  16.  
  17. -(void)shareButtonTapped:(id)sender {
  18.  
  19.     NSString *textToShare = @"Look at this awesome website for aspiring iOS Developers!";
  20.     NSURL *myWebsite = [NSURL URLWithString:@"http://www.codingexplorer.com/"];
  21.  
  22.     NSArray *objectsToShare = @[textToShare, myWebsite];
  23.  
  24.     UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
  25.  
  26.     [self presentViewController:activityVC animated:YES completion:nil];
  27.  
  28. }
  29.  
  30. %end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement