// // ViewController.m // test // // Created by MB985 on 16/2/2. // Copyright © 2016年 科力会. All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UIButton * button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)]; button.backgroundColor = [UIColor blackColor]; [self.view addSubview:button]; [button addTarget:self action:@selector(Click:) forControlEvents:UIControlEventTouchUpInside]; } -(void)Click:(UIButton *)button { UIImage *imageToShare1 = [UIImage imageNamed:@"1.jpg"]; UIImage *imageToShare2 = [UIImage imageNamed:@"2.jpg"]; UIImage *imageToShare3 = [UIImage imageNamed:@"3.jpg"]; UIImage *imageToShare4 = [UIImage imageNamed:@"4.jpg"]; UIImage *imageToShare5 = [UIImage imageNamed:@"5.jpg"]; UIImage *imageToShare6 = [UIImage imageNamed:@"6.jpg"]; UIImage *imageToShare7 = [UIImage imageNamed:@"7.jpg"]; // NSArray * imageArray = @[@"http://mu1.sinaimg.cn/frame.180x240/weiyinyue.music.sina.com.cn/movie_poster/176971_vertical.jpg"]; // UIImageView * imageView = [[UIImageView alloc] init]; // NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageArray[0]]]; // imageView.image = [UIImage imageWithData:data]; // // [self.view addSubview:imageView]; // UIImage * imageToShare = imageView.image; NSArray *activityItems = @[imageToShare1,imageToShare2,imageToShare3,imageToShare4,imageToShare5,imageToShare6,imageToShare7]; // NSArray *activityItems = @[imageToShare,imageToShare,imageToShare,imageToShare]; UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil]; //不出现在活动项目 activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll]; [self presentViewController:activityVC animated:TRUE completion:nil]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end