How to create a UIScrollView Programmatically?

This may be helpful to you for creating the uiscrollview programmatically
http://unconditionalloop.blogspot.com/2011/04/uiscrollview-programmatically.html

  UIScrollView *scrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];   
     NSInteger viewcount= 4;  
     for(int i = 0; i< viewcount; i++) { 

        CGFloat y = i * self.view.frame.size.height;  
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, y,self.view.frame.size.width, self .view.frame.size.height)];       
        view.backgroundColor = [UIColor greenColor];  
        [scrollview addSubview:view];  
        [view release];  
     }    
  scrollview.contentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height *viewcount);   
  [self.view addSubview:scrollview];

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];

Instead of:

UIScrollView *scroll = [UIScrollView alloc];

do this (setting the frame to however big you want the scroll view to be):

UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:...];

try this,

{

        scrollview=[[UIScrollView alloc]initWithFrame:CGRectMake(0,0,320,480)]; 
        scrollview.showsVerticalScrollIndicator=YES;
        scrollview.scrollEnabled=YES;
        scrollview.userInteractionEnabled=YES;
        [self.view addSubview:scrollview];
        scrollview.contentSize = CGSizeMake(width,height);

    [scrollview release];
}