Kishore kumar
Kishore kumar

Reputation: 143

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

Upvotes: 0

Views: 221

Answers (1)

Jason Nam
Jason Nam

Reputation: 2011

Did you check the attributes inspector?

Attributes inspector

Also you can check the buttons are added appropriately by using Xcode layout debugging tool

Xcode Debugging Layout

Upvotes: 2

Related Questions