gpt4 book ai didi

iphone - 挂接到 UIPopoverDelegate 方法以调整弹出窗口的大小 : contentSizeForViewInPopover

转载 作者:可可西里 更新时间:2023-11-01 06:16:48 25 4
gpt4 key购买 nike

我希望在 UIPopoverController 中实现相同的框架平滑扩展行为,当您更改它的 UIView 大小时,但使用 WEPopoverController .目前尚未实现。

UIPopoverController 中的属性 contentSizeForViewInPopover 发生变化时是否会触发某些东西?

最佳答案

尝试在您的类(class)中添加以下行。

[aView addObserver:self forKeyPath:@"frame" options:0 context:NULL];

并实现下面的方法。每次 View 的框架发生变化时都会调用它。

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if([keyPath isEqualToString:@"frame"]) {
//Your code here
}
}

不要忘记在不需要时移除观察者。

[aView removeObserver:self forKeyPath:@"frame"];

关于iphone - 挂接到 UIPopoverDelegate 方法以调整弹出窗口的大小 : contentSizeForViewInPopover,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9981337/

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