简体   繁体   中英

Overriding Size of Element in Superview?

I have a scrollview in my superclass, I want to override its size in one of the subclass views of this superclass.

I am using the following Init but my syntax for selecting the scrollview in the parent is wrong and throwing an error, where am i going wrong here?

The scrollView is in the parent view and i want to resize its frame thats set in the super

    - (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;
}

Error is

Property 'frame' cannot be found in forward class object 'CDCChannelScrollView'

I assume .frame isnt the correct accessor to edit the frame

答案是使用setFrame:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM