How to create a UIScrollView Programmatically?

后端 未结 7 1092
后悔当初
后悔当初 2020-11-30 23:38

Alright, so the key here is I\'m not using IB at all, because the View I\'m working with is created programmatically. The UIView covers the lower half the scre

7条回答
  •  悲&欢浪女
    2020-11-30 23:56

    Create a UiScrollView Programitically

    ScrView = [[UIScrollView alloc]initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height)];
    ScrView.showsVerticalScrollIndicator=YES;
    [ScrView setBackgroundColor:[UIColor yellowColor]];
    [ScrView setScrollEnabled:YES];
    [ScrView setContentSize:CGSizeMake(0, 700)];
    [ScrView setShowsHorizontalScrollIndicator:YES];
    [ScrView setShowsVerticalScrollIndicator:YES];
    [self.view addSubview:ScrView];
    

提交回复
热议问题