【发布时间】:2012-10-29 01:06:34
【问题描述】:
我正在尝试在 UIScrollView 的内容底部设置 UIView,因此我将视图的位置设置为滚动视图的 contentsize 高度。但是我的滚动视图是 UIWebView 的子视图,因此当加载图像时,内容大小的高度会发生变化,而我应该位于滚动视图底部的视图最终会出现在中间......
所以我正在寻找一种在滚动视图的内容大小发生变化时得到通知的方法。我尝试将其子类化并更改 contentsize 的设置器以发送 NSNotification:
@implementation UIScrollView (Height)
-(void)setContentSize:(CGSize)contentSize
{
_contentSize=contentSize;
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"scrollViewContentSizeChanged" object:nil]];
}
@end
但在编译时我得到错误提示:
“_OBJC_IVAR_$_UIScrollView._contentSize”,引用自: -[UIScrollView(Heigth) setContentSize:] 在 MyClass.o ld: 未找到架构 armv7 的符号
知道 setter 应该如何子类化吗?
谢谢!
【问题讨论】:
标签: ios user-interface uiscrollview contentsize