Created
November 30, 2017 06:20
-
-
Save hmhmsh/56a620de01aa8cccfc53b002ee3c9b51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface SnsPostViewController : UIViewController | |
+ (void)showActionSheet:(UIViewController*)vc ActivityItems:(NSArray*)activityItems; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "SnsPostViewController.h" | |
@implementation SnsPostViewController | |
+ (void)showActionSheet:(UIViewController*)vc ActivityItems:(NSArray*)activityItems { | |
UIAlertController* ac = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil]; | |
ac.popoverPresentationController.sourceView = vc.view; | |
// 表示しない機能をリストに入れる | |
// ac.excludedActivityTypes = [[NSArray alloc] initWithObjects: UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, UIActivityTypeMessage, UIActivityTypePostToWeibo, nil]; | |
[vc presentViewController:ac animated:YES completion:nil]; | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)func { | |
NSMutableArray *activityItems = [[NSMutableArray alloc] init]; | |
[activityItems addObject: @"初期文字"]; | |
// [activityItems addObject: [NSURL URLWithString:@"投稿するURL"]]; | |
[activityItems addObject: [UIImage imageNamed:@"初期画像"]]; | |
[SnsPostViewController showActionSheet:self ActivityItems:activityItems]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment