gpt4 book ai didi

iphone - 如何在 View 出现时收到通知?

转载 作者:行者123 更新时间:2023-12-03 20:56:45 26 4
gpt4 key购买 nike

当我进行半页 curl 模式转换时:

alt text

如何判断页面何时恢复到当前状态?我想在“设置” View 关闭时调用某些内容。

我尝试使用viewWillAppear:(BOOL)animated,但关闭 View 时似乎没有被调用。有任何想法吗?

最佳答案

您可以在主视图上注册 NSNotificationCenter 观察者并将通知发布到背景 View 上。您可以使用 viewDidLoad 来代替 viewWillAppear。

//编辑:在给定矩形中获取触摸手势的示例代码

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if ([[event allTouches]count] == 1) {
UITouch *t = [[touches allObjects]lastObject];
CGPoint p = [t locationInView:self.view];
if (p.y < 200) NSLog(@"above 200");
}
}

关于iphone - 如何在 View 出现时收到通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4504399/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com