UIActivityController未在屏幕上显示完整

时间:2017-01-04 07:31:05

标签: ios swift uiactivityviewcontroller

我正在呈现UIActivityController但它在屏幕上显示为一半。enter image description here

 let textToShare = "This is awesome!  Check out this website about it!"
    if let myWebsite = NSURL(string:urlShare) {
        let objectsToShare = [textToShare, myWebsite]
        let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
        //New Excluded Activities Code
        activityVC.excludedActivityTypes = [UIActivityTypeAirDrop, UIActivityTypeAddToReadingList]

        self.navigationController!.presentViewController(activityVC, animated: true, completion: nil)

2 个答案:

答案 0 :(得分:1)

尝试在POP UPViewController内添加

var popup = UIPopoverController(contentViewController: controller)
popup.presentPopoverFromRect(CGRectMake(self.view!.frame.size.width / 2, self.view!.frame.size.height / 4, 0, 0), inView: self.view!, permittedArrowDirections: .Any, animated: true)

此处,控制器是您的 activityVC

答案 1 :(得分:0)

您是否尝试self.presentViewController代替当前ViewController而非self.navigationController

由于我的rootViewController较大,我用这个问题,所以当使用self.navigationController进行展示时,它会被切断。