[iOS6]UIActivity
iOS6から使えるUIActivityを試しました。
UIActivityはこういうやつです。
-(void)startActivity:(int)type{ NSString*text=@"Hello World!! "; NSArray*actItems=nil; UIImage*image=nil; NSURL*url=nil; UIActivityViewController*actView; switch (type) { case 0://text actItems=[NSArray arrayWithObjects:text, nil]; break; case 1://text + image image=_img0.image; actItems=[NSArray arrayWithObjects:text,image, nil]; break; case 2://text + url url=[NSURL URLWithString:_tf0.text]; actItems=[NSArray arrayWithObjects:text,url, nil]; break; default: break; } actView=[[[UIActivityViewController alloc] initWithActivityItems:actItems applicationActivities:nil] autorelease]; actView.completionHandler = ^(NSString *activityType, BOOL completed){ //投稿した時 NSLog(@" activityType: %@", activityType); NSLog(@" completed: %i", completed); if (!completed) {//キャンセル or 失敗 } }; [self presentViewController:actView animated:YES completion:^{ //出現アニメ終了時 NSLog(@"appear!!"); }]; } //実行 [self startActivity:1];