Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 按下新控制器并在导航控制器中再次返回后,将显示iOS ViewController属性_Objective C_Ios - Fatal编程技术网

Objective c 按下新控制器并在导航控制器中再次返回后,将显示iOS ViewController属性

Objective c 按下新控制器并在导航控制器中再次返回后,将显示iOS ViewController属性,objective-c,ios,Objective C,Ios,我找不到解决这个问题的线索,所以我在这里问你 如果有人能帮助我,我会非常高兴 我有一个导航控制器,我正在把TableViewController推进去。我的问题是,当我单击“上一步”按钮时,我的上一个tableViewcontroller会显示上一个数据,但dataArray属性(我的表的数据源)是空的 我的代码: @interface patientViewControllerSearch : UIViewController <UITableViewDelegate, UITabl

我找不到解决这个问题的线索,所以我在这里问你

如果有人能帮助我,我会非常高兴

我有一个导航控制器,我正在把TableViewController推进去。我的问题是,当我单击“上一步”按钮时,我的上一个tableViewcontroller会显示上一个数据,但dataArray属性(我的表的数据源)是空的

我的代码:

  @interface patientViewControllerSearch : UIViewController <UITableViewDelegate, UITableViewDataSource, ASIHTTPRequestDelegate>
{
    NSMutableArray *dataArray;
    NSMutableArray *letters;

    UITableView *tableView;
    IBOutlet UISearchBar *searchBar;
}

@property (nonatomic, retain) IBOutlet UITableView *tableView;
@property (nonatomic, retain) esTabBarController *esTabBarController;
@property (nonatomic, retain) UISearchBar *searchBar;
通过HTTP请求,我填充了我的数组

那很好

之后:

[self.navigationController pushViewController:controller                                         animated:YES];
当我回来时,(viewDidload没有再次加载,这就是为什么没有新的填充dataArray的请求)dataArray,所有内容都是空的。tableView显示了我以前的状态,但刷新后也会消失

你有什么建议吗

提前感谢。

之所以没有调用“viewDidLoad”,是因为它第一次出现在您的应用程序中时就已经加载了(我假设是在启动时)

您会注意到,在应用程序中显示视图之前/之后,始终会调用“viewWillAppear”和“viewDidAppear”


如果您希望在向用户显示视图时更新数据,则可以使用这些方法

谢谢你的回答。但是你能告诉我为什么我的数组总是出现吗?如果这个阵列能留在记忆中,我会很高兴的。我有一个由另一个人编写的控制器,他在那里创建了一个
data=[[[configManager sharedInstance].config objectForKey:@“institutionList”]retain]在ViewDidLoad中,当我返回时,整个数组将保留在内存中。
[self.navigationController pushViewController:controller                                         animated:YES];