我想將用戶輸入的任何字符串傳遞給指派給來自NSString的UITextField的不兼容指針類型的UITextField' over to the destination view controller, but when I NSLog the value in the destination, it shows up as null. I'm also getting a warning stating:
。我該如何正確地完成任務並將其發送出去?在將UITextField的內容從一個控制器傳遞到另一個控制器時遇到問題
始發視圖控制器
SearchViewController.m:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
controller.itemSearch = self.itemSearch.text;
}
SearchViewController.h:
@property (weak, nonatomic) IBOutlet UITextField *itemSearch;
目的地視圖控制器
UserCategoryChooserViewController.h:
#import <UIKit/UIKit.h>
#import "SearchViewController.h"
@interface UserCategoryChooserViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *itemSearch;
UserCategoryChooserViewController.m:
NSLog(@"The text is:'%@'", self.itemSearch.text); // results in (null)
可能重複[在視圖控制器之間傳遞數據](http://stackoverflow.com/questions/5210535/passing-data-between-view-controllers) – nhgrif