在xcode 8中共享按钮和收藏夹文件夹

时间:2017-05-22 12:56:56

标签: ios xcode social-networking socialshare action-button

So this is my code: 
@IBOutlet weak var quoteLabel: UILabel!
var quotes = ["I am no 1", "I am no2", "I am no3"]
var currentQuoteIndex = 0 
@IBAction func forwardAction(_ sender: UIButton) {
            currentQuoteIndex += 1

    if currentQuoteIndex >= quotes.count

    {
        currentQuoteIndex = 0

    }

    quoteLabel.text = quotes[currentQuoteIndex]

}

@IBAction func backwardAction(_ sender: UIButton) {

    currentQuoteIndex -= 1
    if currentQuoteIndex < 0 {
        currentQuoteIndex = quotes.count - 1
    }
    quoteLabel.text = quotes[currentQuoteIndex]

}


@IBAction func shareButton(_ sender: Any) {



   let activityVC = UIActivityViewController(activityItems:     
   [self.quoteLabel.text!], applicationActivities: nil)

    activityVC.popoverPresentationController?.sourceView = self.view
    self.present(activityVC, animated: true, completion: nil)

}
}

So my questions are: 
No.1:  I want to add an alert message in share button so that any user who
 doesnt have facebook or any other social app connected to the app, would
get the warning message "You are not connected to Facebook". And every other 
social media apps such as twitter. 
No.2: I also want to add two more folders with the name "favorites" and 

&#34;家用&#34;这样用户就可以点击&#34;收藏夹&#34;按钮和报价是     直接添加到那个&#34;收藏夹&#34;文件夹和书面信息     屏幕&#34;添加到收藏夹&#34;。我还要添加一个&#34;主页按钮&#34;所以
    当用户进入显示两个文件夹的主屏幕时,     那是,&#34;报价&#34;通过点击将获得所有引用     我已经加入了应用程序而没有2&#34;收藏夹&#34;文件夹,以便引号     用户喜欢存储在那里并可以通过点击访问。     非常感谢你提前。

1 个答案:

答案 0 :(得分:0)

  1. 这是不可能的,而且从UX点也没有任何意义,因为用户在点击Facebook等时已经获得了该消息,而他可能不想与每个可能的来源共享并警告他是没有登录很烦人。
  2. 您可以使用UIActivity