Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <UIKit/UIKit.h>
- %hook TestSettingsController
- -(void)viewDidLoad {
- %orig;
- UIBarButtonItem *shareButton = [[UIBarButtonItem alloc]
- initWithBarButtonSystemItem:UIBarButtonSystemItemAction
- target:self
- action:@selector(shareButtonTapped:)];
- [[self navigationItem] setRightBarButtonItem:shareButton animated:NO];
- }
- %new
- -(void)shareButtonTapped:(id)sender {
- NSString *textToShare = @"Look at this awesome website for aspiring iOS Developers!";
- NSURL *myWebsite = [NSURL URLWithString:@"http://www.codingexplorer.com/"];
- NSArray *objectsToShare = @[textToShare, myWebsite];
- UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
- [self presentViewController:activityVC animated:YES completion:nil];
- }
- %end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement