我正在使用storyboard scrollview但它没有滚动,如何使其成为可滚动的。
这是我的代码
-(void)scrollView
{
self.scrollViewBtn.pagingEnabled=YES;
self.scrollViewBtn.scrollEnabled=YES;
for(int i=0;i<[[arrFullSubCategory valueForKey:@"name"]count];i++)
{
CGRect frame;
frame.origin.x=self.scrollViewBtn.frame.size.width *i;
frame.origin.y=0;
frame.size=self.scrollViewBtn.frame.size;
UIButton *btn=[[UIButton alloc]initWithFrame:frame];
[btn setTitle:[NSString stringWithFormat:@"%@",[[arrFullSubCategory objectAtIndex:i] valueForKey:@"name"]] forState:UIControlStateNormal];
[self.scrollViewBtn addSubview:btn];
btn.backgroundColor=[UIColor colorFromHexString:@"#ffc400"];
btn.userInteractionEnabled=YES;
length = [[arrFullSubCategory valueForKey:@"name"] count];
}
self.scrollViewBtn.contentSize=CGSizeMake(self.scrollViewBtn.frame.size.width *length, self.scrollViewBtn.frame.size.height-60);
}