How to pass data in conditional unwind segue?

前端 未结 3 446
失恋的感觉
失恋的感觉 2021-01-29 06:25

I try to build an rss reader. On the \"adding feed\" page, if I tap the \"add\" button, I hope to check if the feed is successfully added. If it is added, then trigger the unwin

3条回答
  •  旧时难觅i
    2021-01-29 07:08

    You can always use delegates.

    Set up a delegate in your add feed page and get mainViewController to conform to the delegate. Add a delegate method (- (BOOL)canGenerateFeed:(NSURL *)url) and a delegate property (@property (weak, nonatomic) id delegate).

    When your add feed page calls [self.delegate canGenerateFeed:url] and your mainViewController conforms to the delegate, the method in mainViewController is called (that should reply BOOL as stated in the method declaration). Then you can reply YES or NO accordingly, which will be sent back through to the add feed page.

提交回复
热议问题