1
我的項目是整個故事板,我有一個UITableViewController
嵌入在NavigationController
和每個單元格我有一個按鈕來分享通知。UINavigationBar隱藏時提供activityViewController
@IBAction func shareSheetButtonFeed(sender: AnyObject) {
let btnPos: CGPoint = sender.convertPoint(CGPointZero, toView: self.tableView)
let indexPath: NSIndexPath = self.tableView.indexPathForRowAtPoint(btnPos)!
passaValor = Int(indexPath.row)
let printtestess = (objects?[passaValor] as! PFObject)
let textToShare: AnyObject = (printtestess.objectForKey("subject")! as! String) + " - Cheque agora em:"
let myWebsite = NSURL(string:"http://www.mysite.com.br/")
let img: UIImage = UIImage(named: "myLogo-1024x1024")!
guard let url = myWebsite else {
print("nothing found")
return
}
self.navigationController?.setNavigationBarHidden(false, animated: true)
let shareItems:Array = [img, textToShare, url]
let activityViewController:UIActivityViewController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil)
activityViewController.excludedActivityTypes = [UIActivityTypePrint, UIActivityTypePostToWeibo, UIActivityTypeCopyToPasteboard, UIActivityTypeAddToReadingList, UIActivityTypePostToVimeo]
self.presentViewController(activityViewController, animated: true, completion: nil)
}
問題是,當我在點擊該按鈕的shareSheet提出後,我選擇了社交網絡,Twitter或Facebook等我以前的導航欄dissapear。
我試着用這條線,按鈕內解決問題,當我在按鈕再點擊導航欄重新顯示:
self.navigationController?.setNavigationBarHidden(false, animated: true)
所以我試圖把ViewWillAppear
內這條線,但它不工作。
Obs:我正在使用自動佈局
謝謝。
完美的解決方案,我只需要等待16小時獎勵賞金。 –