2017-04-02 9 views
2

iOS 공유 확장 프로그램을 만드는 방법을 알고 있지만 확장 프로그램과 같은 전체 화면을 만들 수있는 방법이 있다면 알아낼 수없는 부분이 있습니까?전체 화면 iOS 공유 확장 프로그램

Pinterest이 일을하는 것처럼 보이지만 어떻게해야할지 모르겠다. 액션 확장을위한

워드 프로세서 사용하는 말 : 확장에 대한 PLIST 파일에서

  <key>NSExtensionActionWantsFullScreenPresentation</key> 
    <true/> 

을하지만이 공유 확장에 영향을하지 않는 것?

어쨌든 이것을 수행 할 예정입니까?

답변

4

당신은 iOS Full Screen Share Extension 거기에서 아이디어를 얻을 수 있으며,이 스위프트 3스위프트 4

EntryViewController

import UIKit 

@objc(EntryViewController) 

class EntryViewController : UINavigationController { 

    override init(rootViewController: UIViewController) { 
     super.init(rootViewController: ShareViewController()) 
    } 

    required init(coder aDecoder: NSCoder) { 
     super.init(coder: aDecoder)! 
    } 

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 
     super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 
    } 

    override func viewWillAppear(_ animated: Bool) { 
     super.viewWillAppear(animated) 
     self.view.transform = CGAffineTransform(translationX: 0, y: self.view.frame.size.height) 
     UIView.animate(withDuration: 0.3, animations: {() -> Void in 
      self.view.transform = .identity 
     }) 
    } 

} 

와 호환되는 아래의 코드 조각에 대한 업데이트 된 구문을 찾을 수 있습니다 ShareViewController

import UIKit 
import Social 

class ShareViewController: SLComposeServiceViewController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     self.view.backgroundColor = UIColor.white 
     self.navigationItem.title = "Share" 

     self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: Selector(("cancelButtonTapped:"))) 
     self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: Selector(("saveButtonTapped:"))) 
    } 

    func saveButtonTapped(sender: UIBarButtonItem) { 
     self.hideExtensionWithCompletionHandler(completion: { (Bool) -> Void in 
     self.extensionContext!.completeRequest(returningItems: nil, completionHandler: nil) 
     }) 
    } 

    func cancelButtonTapped(sender: UIBarButtonItem) { 
     self.hideExtensionWithCompletionHandler(completion: { (Bool) -> Void in 
     self.extensionContext!.cancelRequest(withError: NSError()) 
     }) 
    } 

    func hideExtensionWithCompletionHandler(completion: @escaping (Bool) -> Void) { 
     UIView.animate(withDuration: 0.3, animations: { 
     self.navigationController!.view.transform = CGAffineTransform(translationX: 0, y: self.navigationController!.view.frame.size.height) 
     }, completion: completion) 
    } 

} 
+0

나를 위해 작동하지 않습니다. UINavigationController를로드하지만 루트가 표시되지 않습니다. –