ScrollView没有显示水平滚动指示器iOS

时间:2014-04-04 06:22:23

标签: ios objective-c uiscrollview

我正在尝试为我的scrollView显示水平滚动视图指示器。我能够在其中显示内容但是,显示指示器尚未成功。我已经尝试将showsHorizontalScrollIndicator设置为YES,两者都在代码以及StoryBoard。我错过了什么?

- (void)viewDidLoad
{
[super viewDidLoad];
self.scrollView.delegate =self;
int x =5;
int y=10;
int width = 50;
int height = 50;
int buffer =10;
for (int i=0; i<=10; i++) {
    UIButton *imgButton = [UIButton buttonWithType:UIButtonTypeCustom];
    imgButton.frame = CGRectMake(x, y, width, height);
    [imgButton setTitle:@"A" forState:UIControlStateNormal];
    [imgButton setBackgroundColor:[UIColor greenColor]];
    [self.scrollView addSubview:imgButton];
    x= width+buffer;
}

[self.scrollView setContentSize:CGSizeMake(500, 1)];
self.scrollView.backgroundColor = [UIColor whiteColor];
self.scrollView.showsHorizontalScrollIndicator =YES;
}

滚动视图框架为:X-160,Y -232,宽度 - 273,高度 - 114

几乎没有变化,这是它的外观,但仍然没有水平指标

enter image description here

0 个答案:

没有答案