【发布时间】:2011-03-28 10:36:32
【问题描述】:
我想将 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?
【问题讨论】:
-
哇!我所要做的就是添加到 subView,之后似乎会自动处理事情:)
标签: iphone objective-c xcode uiscrollview uicontrol