覆盖Superview中元素的大小?

时间:2017-05-22 10:06:03

标签: ios objective-c inheritance

我的超类中有一个scrollview,我想在这个超类的一个子类视图中覆盖它的大小。

我正在使用以下Init,但我在父级中选择scrollview的语法错误并抛出错误,我在哪里错了?

scrollView位于父视图中,我想调整其在超级

中设置的框架的大小
    - (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
    [super scrollView]; CGRectMake(50, 0, self.width - 50, self.height);
        [self setControlArray:[NSMutableArray new]];
        [self setBusOffset:1];
        [self addBusToView];
        [self addBusNavigationToView];
    }
    return self;
}

错误是

  

财产'框架'在转发类对象&CDCChannelScrollView'

中找不到

我认为.frame不是编辑框架的正确访问者

1 个答案:

答案 0 :(得分:1)

答案是使用setFrame:

[self.scrollView setFrame:CGRectMake(50, 0, self.width - 170, self.height)];