ios - 重新加载 viewDidAppear 以便它将用作 ViewDidLoad

标签 ios viewdidload

在我的 viewDidAppear 中,我正在更改其中一个 ImageView 的框架。在我 [self viewDidAppear] 之前, View 和所有其他方法都不会显示它。 我感觉不对,有没有reloadData消息?

谢谢。

最佳答案

没错,自己调用[self viewDidappear]是不对的。

如果您需要在 View 上更改 View 的框架,请自己创建一个您可以随时调用的方法,或者使用 viewDidLayoutSubviews

When the bounds change for a view controller’s view, the view adjusts the positions of its subviews and then the system calls this method. However, this method being called does not indicate that the individual layouts of the view’s subviews have been adjusted. Each subview is responsible for adjusting its own layout.

另外,检查你的方法是否有正确的实现:

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    //Your code
}

关于ios - 重新加载 viewDidAppear 以便它将用作 ViewDidLoad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19362240/

相关文章:

ios - 如何在 xamarin.ios 中使用 cocoapods

ios - 无法在 segue 中取消选中 UITableViewCell

ios - ITMS-90809 : Deprecated API Usage — Apple will stop accepting submissions of apps that use UIWebView APIs When upload my react native app

ios - 关于不直接调用 viewDidLoad 的文档?

ios - 在 ViewController 中播放时从 SKScene 静音 AVAudioPlayer

ios - 在解析中从用户获取 objectId

swift - 如何修复 viewDIdLoad 中的 indexPath 错误?

ios - 一种在每次快速运行时重新加载 ViewDidLoad 的方法

ios - 想要清理我的 viewDidLoad 方法

iphone - 我是否以编程方式在 ViewDidAppear、ViewDidLoad、ViewWillAppear、构造函数中添加 subview ?