import
UIKit
class
WeiXinActivity
:
UIActivity
{
var
text:
String
!
var
url:
NSURL
!
var
image:
UIImage
!
override
func
activityTitle() ->
String
? {
return
"微信"
}
override
func
activityImage() ->
UIImage
? {
return
UIImage
(named:
"wechat_session"
)
}
override
func
activityType() ->
String
? {
return
WeiXinActivity
.
self
.description()
}
override
class
func
activityCategory() ->
UIActivityCategory
{
return
UIActivityCategory
.
Share
}
override
func
canPerformWithActivityItems(activityItems: [
AnyObject
]) ->
Bool
{
for
item
in
activityItems {
if
item
is
UIImage
{
return
true
}
if
item
is
String
{
return
true
}
if
item
is
NSURL
{
return
true
}
}
return
false
}
override
func
prepareWithActivityItems(activityItems: [
AnyObject
]) {
println
(
"prepareWithActivityItems"
)
for
item
in
activityItems {
if
item
is
UIImage
{
image = item
as
!
UIImage
}
if
item
is
String
{
text = item
as
!
String
}
if
item
is
NSURL
{
url = item
as
!
NSURL
}
}
}
override
func
performActivity() {
println
(
"performActivity"
)
}
override
func
activityViewController() ->
UIViewController
? {
println
(
"activityViewController"
)
return
nil
}
override
func
activityDidFinish(completed:
Bool
) {
println
(
"activitydidfinish"
)
}
}
请发表评论