0

I am new to both sharekit and ios development. Would like to have some help in implementing sharekit from a button instead of a toolbar..

For example, I sharing an link:

- (IBAction) btnShareClicked :(id)sender;
{
    SHKItem *item = [SHKItem URL:webView.request.URL title:[webView pageTitle]];
    SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
    [actionSheet showFromToolbar:self.navigationController.toolbar];
}

How do change this example code to include the button instead of a toolbar.. Need some guidance.. Sorry if it is a stupid question...

lakshmen
  • 28,346
  • 66
  • 178
  • 276

2 Answers2

1
- (IBAction) btnShareClicked :(id)sender;
{
     NSString *text = @"Hello";

    SHKItem *item = [SHKItem text:text];
    SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];  
    [actionSheet showInView:self.view];
}
lakshmen
  • 28,346
  • 66
  • 178
  • 276
1

Just check the UIActionSheet documentation...

e.g.

[actionSheet showInView:[sender view];

or:

[actionSheet showFromRect:[[sender view] frame] inView:[[sender view] superview] animated:YES];

assuming that the sender is your button, which it should be.

Paul Lynch
  • 19,769
  • 4
  • 37
  • 41