The code is fine. It will work once you setText to UILabel, You have used
[l1 sizeToFit];
sizeToFit resizes and moves the view so it encloses its subviews. Since you dont have text in UILabel its width and height will be (0,0)
-(IBAction)slideback:(id)sender {
viol=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 44.8, 320, 420)];
viol.contentSize=CGSizeMake(320, 900);
viol.showsVerticalScrollIndicator=YES;
viol.backgroundColor=[UIColor grayColor];
viol.delegate=self;
[self.view addSubview:viol];
l1=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 700)];
l1.backgroundColor=[UIColor redColor];
l1.font=[UIFont boldSystemFontOfSize:16];
[l1 setNumberOfLines:0];
// [l1 sizeToFit];
[viol addSubview:l1];
CATransition *animation = [CATransition animation];
[animation setDuration:2];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
[[l1 layer] addAnimation:animation forKey:@"SlideView"];
}