久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將數據傳回前一個控制器

Pass data back to the previous controller(將數據傳回前一個控制器)
本文介紹了將數據傳回前一個控制器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我在故事板中有兩個控制器,嵌入在 NavigationController 中,并且有一個 segue 可以在它們之間切換.

I have two controllers in the storyboard, embedded in a NavigationController, and there is a segue to switch between these.

通過實現 prepareForSegue 將數據從第一個控制器傳遞到第二個控制器非常簡單,并使用 segue.destinationViewController 設置第二個控制器的屬性.

Passing data from the first controller to the second one is pretty straightforward by implementing prepareForSegue, and set the properties of the second controller using segue.destinationViewController.

我也應該將數據從第二個控制器傳回到前一個控制器.我用谷歌搜索,但我沒有找到任何簡單但有效的代碼來演示它.

I should pass back data to the from the second controller to the previous one also. I googled, but I have not found any simple, but working code to demonstrate it.

您能不能給我一個簡單的示例,說明最好的方法?

Would you be so kind give me a simple sample about the best way to do it?

提前致謝!

推薦答案

在您的第二個視圖控制器類中,您創建一個協議和委托.第一個視圖控制器將自己設置為 prepareForSegue 中的委托并實現協議方法.然后,第二個視圖控制器將調用方法將數據傳回第一個視圖控制器.以下是我的一個項目中的一些代碼作為示例.

In your second view controller class you create a protocol and delegate. The first view controller will set it self as the delegate in prepareForSegue and implement the protocol methods. The second view controller will then call the methods to pass data back to the first view controller. Here is some code from one of my projects as an example.

@protocol TableSelectorDelegate <NSObject>

@optional
- (void)didMakeSelection:(id)selectionString forType:(NSString *)dataTitle;
- (void)didAddNewValue:(NSString *)newValue forType:(NSString *)dataTitle;

@end

@interface TableSelectorViewController : UITableViewController  

@property (nonatomic, weak) id<TableSelectorDelegate> delegate;

@end

這篇關于將數據傳回前一個控制器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

KIF: How to auto-run/stress test an iOS app to find the cause of a rare UI bug?(KIF:如何自動運行/壓力測試 iOS 應用程序以找出罕見 UI 錯誤的原因?)
Can#39;t change target membership visibility in Xcode 4.5(無法更改 Xcode 4.5 中的目標成員身份可見性)
UITableView: Handle cell selection in a mixed cell table view static and dynamic cells(UITableView:在混合單元格表視圖靜態和動態單元格中處理單元格選擇)
How to remove Address Bar in Safari in iOS?(如何在 iOS 中刪除 Safari 中的地址欄?)
iOS 5 SDK is gone after upgrade to Xcode 4.5(升級到 Xcode 4.5 后,iOS 5 SDK 消失了)
Having trouble creating UIImage from CIImage in iOS5(在 iOS5 中從 CIImage 創建 UIImage 時遇到問題)
主站蜘蛛池模板: 久久99精品久久久久久狂牛 | 欧美中文在线 | 中文字幕动漫成人 | 欧美在线一区二区三区 | 91麻豆精品国产91久久久更新资源速度超快 | 国产高清在线视频 | 日本在线黄色 | 91久久夜色 | 成人一区二区三区在线 | 国产亚洲精品精品国产亚洲综合 | 久久久网 | 伊人电影院av | 午夜激情在线视频 | 久久久久久国产精品mv | 91 在线 | 久久99久久99精品免视看婷婷 | 日韩成人在线观看 | 黄色片免费 | 三级视频国产 | 91精品国产综合久久婷婷香蕉 | 国产精品日韩在线观看 | 天天拍夜夜爽 | 久草在线 | 欧美美女被c | 看片91 | 天天天天操 | 日韩欧美国产精品一区二区三区 | 欧美一级在线观看 | 欧美精品中文字幕久久二区 | 国产一区不卡在线观看 | 性高湖久久久久久久久3小时 | 一级黄色日本片 | 日韩中文字幕网 | 欧美二区在线 | 亚洲一区二区三区视频 | 91精品国产91久久久久久 | 国产特级毛片 | 欧美在线观看一区 | 国产在线精品一区二区 | 午夜影院| 天天碰日日操 |