我想将 UIControls 添加到 UIScrollView,例如。
UIControl *couponView = [[UIControl alloc] initWithFrame:CGRectMake(drawX,drawY,couponWidth,couponHeight)];
couponView.backgroundColor = [UIColor redColor];
[[scrollView contentView] addSubview:couponView]; //may not respond
[scrollview.contentView addSubview:couponView]; //not a member
我还想根据我添加的 UIControls 设置 contentView 的框架。我在想我会将框架设置在远离屏幕的 Y 方向上,并且 UIScrollView 会在用户滚动时将屏幕外部分滚动到可见性中。
我没有在 UIScrollView 中看到 contentView 属性。如何访问 contentView?