ios - How to set a delegate to dismiss a modal and then call a function -
using swift, trying dismiss modal programmatically. utilize apple's recommended technique:
when comes time dismiss presented view controller, preferred approach allow presenting view controller dismiss it. in other words, whenever possible, same view controller presented view controller should take responsibility dismissing it.(1)
https://developer.apple.com/library/ios/featuredarticles/viewcontrollerpgforiphoneos/modalviewcontrollers/modalviewcontrollers.html#//apple_ref/doc/uid/tp40007457-ch111-sw14how do swift? need set presenting view controller delegate, , when "done" button tapped in modal, phone call function in presenting view controller dismiss.
note have created modal segue in storyboard.
in presenting view controller, have function written:
func modaldismissed(){ self.dismissmodalviewcontrolleranimated(true) println("modal dismissed") } i looked around, , found post, not exclusively helpful. in addition, set observer hear when modal closes--not recommended. how can observe dismissal of modal view controller in parent view controller?
references: https://developer.apple.com/library/ios/featuredarticles/viewcontrollerpgforiphoneos/modalviewcontrollers/modalviewcontrollers.html
https://developer.apple.com/library/ios/featuredarticles/viewcontrollerpgforiphoneos/managingdataflowbetweenviewcontrollers/managingdataflowbetweenviewcontrollers.html#//apple_ref/doc/uid/tp40007457-ch8-sw9
note: if downvote, please explain why
ios delegates modal-dialog swift
No comments:
Post a Comment