社交分享(一)系統自帶分享功能

2021-07-14 04:15:32 字數 1431 閱讀 8343

本文主要介紹一下系統自帶的分享服務框架。 ios系統為我們提供了兩個不同的類來實現分享服務。

示例**:

- (ibaction)social:(id)sender 

// 2. 建立分享檢視控制器,並指定分享平台

slcomposeviewcontroller *composevc = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypesinaweibo];

/* 系統支援的分享功能可以分享的平台

social_extern nsstring *const slservicetypetwitter

social_extern nsstring *const slservicetypefacebook

social_extern nsstring *const slservicetypesinaweibo

social_extern nsstring *const slservicetypetencentweibo

social_extern nsstring *const slservicetypelinkedin

*/// 3. 設定分享內容

[composevc setinitialtext:@"系統自帶的社交分享服務"];

// 4. 進入分享介面

[self presentviewcontroller:composevc animated:yes completion:^];

// 5. 監聽使用者操作

[composevc setcompletionhandler:^(slcomposeviewcontrollerresult result) else

if (result == slcomposeviewcontrollerresultdone)

}];}

在ios6之後系統為我們提供了乙個分享列表檢視,它通過uiactivityviewcontroller管理。蘋果設計它的主要目的是替換分享動作,分享動作選單是出於分享目的的動作選單。內建活動列表項主要有一下幾個:

示例**:

- (ibaction)activity:(id)sender else 

}];}

實現效果:

iOS系統自帶分享功能

1 2345 6789 1011 1213 1415 1617 1819 2021 2223 2425 2627 void touchesbegan nsset touches withevent uievent event 建立控制器,並設定servicetype slcomposeviewcon...

Android分享 呼叫系統自帶的分享功能

這裡就記錄下第一種辦法。intent textintent new intent intent.action send textintent.settype text plain textintent.putextra intent.extra text,這是一段分享的文字 startactivit...

微信app右上角自帶分享功能

2 可以通過開發 介面許可權檢視自己是否獲取到了分享事件的許可權。3 在頁面引入js檔案 注 支援https 支援使用 amd cmd 標準模組載入方法載入 應盡可能早的載入,建議放置到頁面head裡載入。4 配置config 所有需要使用js sdk的頁面必須先注入配置資訊,否則將無法呼叫。wx....