My app support iOS 7+, I use UIActivity image size: 60pt for iPhone, 76pt for iOS for iPad,
When touch more button to re-order the items, it can't show the icon in the list.
CODE as below:
class ZYShare {
class ActivityItem {
init() {
self.title = ""
self.icon = ""
}
var title: String?
var icon: String?
var type: ShareType = ShareTypeAny
}
class CommonActivity: UIActivity {
lazy var itemInfo = ActivityItem()
override func prepareWithActivityItems(activityItems: [AnyObject]) {
// do something
}
override func canPerformWithActivityItems(activityItems: [AnyObject]) -> Bool {
return true
}
override class func activityCategory() -> UIActivityCategory {
return UIActivityCategory.Action
}
override func activityType() -> String? {
return NSLocalizedString(itemInfo.title ?? "", comment: "")
}
override func activityTitle() -> String? {
return NSLocalizedString(itemInfo.title ?? "", comment: "")
}
override func activityImage() -> UIImage? {
println(itemInfo.icon)
if let icon = itemInfo.icon {
return UIImage(named: icon)
} else {
return nil
}
}
override func performActivity() {
ShareSDK.showShareViewWithType(itemInfo.type
, container: nil
, content: publishContent
, statusBarTips: false
, authOptions: authOptions
, shareOptions: options
, result: handle)
self.activityDidFinish(true)
}
}
class QQActivity: CommonActivity {
override init() {
super.init()
self.itemInfo.icon = "ShareToQQ"
self.itemInfo.title = "QQ"
self.itemInfo.type = ShareTypeQQ
}
}
class WeChatSessionActivity: CommonActivity {
override init() {
super.init()
self.itemInfo.icon = "ShareToWeChat"
self.itemInfo.title = "微信"
self.itemInfo.type = ShareTypeWeixiSession
}
}
class WeChatTimelineActivity: CommonActivity {
override init() {
super.init()
self.itemInfo.icon = "ShareToWeChatTimeLine"
self.itemInfo.title = "朋友圈"
self.itemInfo.type = ShareTypeWeixiTimeline
}
}
class QQSpaceActivity: CommonActivity {
override init() {
super.init()
self.itemInfo.icon = "ShareToQzone"
self.itemInfo.title = "QQ空间"
self.itemInfo.type = ShareTypeQQSpace
}
}
}