Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arnieterm

macrumors regular
Original poster
Aug 28, 2008
201
0
Hi
working on UIScrollView for the first time. here is my code


Code:
hitscontents = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,150,300)];
	
	hitscontents.autoresizingMask = UIViewAutoresizingFlexibleHeight;
	hitscontents.backgroundColor = [UIColor whiteColor];	
	hitscontents.showsHorizontalScrollIndicator = NO;
	hitscontents.showsVerticalScrollIndicator = YES;	
	
	
		
	NSString *bulletSymbol = [NSString stringWithFormat:@"%C", 0x2219];	 
	//NSArray *arrayHitLabels = [NSArray arrayWithObjects:  @"HomePage", @"Sales Page", @"Product Page", @"Contact Us", nil];
	NSArray *arrayHitLabels = [NSArray arrayWithObjects:  @"HomePage", @"Sales Page", @"Product Page", @"Contact Us", @"Sales Page", @"Sales Page", @"Sales Page",@"Sales Page",@"Sales Page",@"Sales Page",@"Sales Page",@"Sales Page",@"Sales Page" ,@"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", nil];
	NSArray *arrayHitLabelsData = [NSArray arrayWithObjects:   @"HomePage", @"Sales Page", @"Product Page", @"Contact Us", @"Sales Page", @"Sales Page", @"Sales Page",@"Sales Page",@"Sales Page",@"Sales Page",@"Sales Page",@"Sales Page",@"Sales Page" ,@"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", @"HomePage", nil];
	//NSArray *arrayHitLabelsData = [NSArray arrayWithObjects:  @"HPCount", @"SPCount", @"PPCount", @"CUCount", nil];
	
	for(int a = 0, b = 0 ; a < [arrayHitLabels count],  b < [arrayHitLabels count]* 30 ; a++,  b= b + 30){
		UILabel *lblHits = [[UILabel alloc] init];
		
		lblHits.text = [ [ [bulletSymbol stringByAppendingString: [arrayHitLabels objectAtIndex:a]] stringByAppendingString:@", "] stringByAppendingString: [arrayHitLabelsData objectAtIndex:a] ];
		if(a == 0){
			lblHits.frame = CGRectMake(kLeftMargine, 0.0,  200.0, kLabelHeight);
		}
		else{
			lblHits.frame = CGRectMake(kLeftMargine,  10.0 + b,  200.0, kLabelHeight);
		}
		[hitscontents addSubview:lblHits];
	}
	[self addSubview:hitscontents];

What is wrong with this code?? I am not able to view the scrollbars. What additional do i needs to be done?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.