因此,在 Interface Builder 中,我在包含两个 Image View 对象的 super View 中有一个 View 。我想在应用程序启动时将该 View 移出屏幕,以便它可以动画移动到位。该 View 在界面的 .h 文件中被描述为 pictureFrame,我将 View 映射到导出 pictureFrame。这是我当前的 viewDidLoad:
- (void)viewDidLoad {
[super viewDidLoad];
CGRect theFrame = [self.pictureFrame frame];
theFrame.origin.y = -290;
}
但是,它似乎不起作用。我该如何解决这个问题?
最佳答案
您忘记设置 View 的框架:
CGRect theFrame = [self.pictureFrame frame];
theFrame.origin.y = -290;
添加这个就可以了:
self.pictureFrame.frame = theFrame;
关于iPhone dev - 在 viewDidLoad 中设置 View 的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2358914/