久久久久久久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 時遇到問題)
主站蜘蛛池模板: 毛片免费观看视频 | 狠狠色网 | 操操日| 国产在线看片 | 黄色一级免费观看 | 欧美成人一区二区三区 | 久久久www成人免费无遮挡大片 | 久久久国产一区二区三区 | 国产日韩精品视频 | 精品一区av | 国产你懂的在线观看 | 欧美一区二区在线免费观看 | 中文字幕在线一区二区三区 | 欧美一区二区三区在线 | 午夜影院网站 | 亚洲电影一区二区三区 | 国产成人高清成人av片在线看 | 国产成人午夜高潮毛片 | 欧美精品一区二区免费视频 | 国内精品一区二区 | 综合欧美亚洲 | 国内精品视频在线 | 在线观看成年视频 | 黄色大片在线 | 国产在线精品一区二区三区 | 午夜小电影 | 天堂一区二区三区 | 日韩在线观看一区 | 久久精品亚洲一区 | 日本免费视频在线观看 | 9999久久| 国产一区二区三区四区五区3d | 国产精品一区二区不卡 | 天天干成人网 | 亚洲免费在线 | 青青久久av北条麻妃海外网 | 99精品视频免费观看 | 亚洲男人的天堂网站 | 中文字幕欧美一区二区 | 特一级毛片 | 日韩欧美国产一区二区三区 |