[英]How to make Scrollable the Storyboard Scrollview?
i am using storyboard scrollview but its didn't scroll ,how to make it as scrollable.我正在使用故事板滚动视图,但它没有滚动,如何使其可滚动。
This is my code这是我的代码
-(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);
}
Did you check the attributes inspector?你检查属性检查器了吗?
Also you can check the buttons are added appropriately by using Xcode layout debugging tool您也可以使用 Xcode 布局调试工具检查按钮是否正确添加
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.