zoukankan      html  css  js  c++  java
  • IOS 社交分享

    #import <Social/Social.h>
    
    @interface HMViewController ()
    
    @end
    
    @implementation HMViewController
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
    }
    
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        // 新浪微博服务不可用
        if (![SLComposeViewController isAvailableForServiceType:SLServiceTypeSinaWeibo]) return;
        
        // 1.创建分享控制器
        SLComposeViewController *cvv = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeSinaWeibo];
        // 设置初始化数据
        [cvv setInitialText:@"郭XX xx xx -- 新闻链接:http://www.baidu.com/news/5435345"];
        [cvv addImage:[UIImage imageNamed:@"lufy"]];
    
        // 2.显示控制器
        [self presentViewController:cvv animated:YES completion:nil];
        
        // 3.设置block监听
        cvv.completionHandler = ^(SLComposeViewControllerResult result){
            if (result == SLComposeViewControllerResultCancelled) {
                NSLog(@"取消发送");
            } else {
                NSLog(@"发送完毕");
            }
        };
    }
    
    @end
  • 相关阅读:
    CSS——清除浮动
    .net 多线程之线程取消
    .net 多线程临时变量
    NPOI helper
    添加学员存储过程
    SQL-sqlHelper001
    ado.net 中事务的使用
    T-SQL 事务2
    T-SQL 事务
    T-SQL 带参数存储过程
  • 原文地址:https://www.cnblogs.com/liuwj/p/6878572.html
Copyright © 2011-2022 走看看