Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. // BEGIN ScrollView Test
  2. UIScrollView *MyScrollViewObj = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 112.0, 342.0, 50.0)];
  3. // Adjust the width to be larger to make it scroll horizontal
  4. // Adjust the height to be larger to be scrolled vertical
  5. [MyScrollViewObj setContentSize:CGSizeMake(3420.0, 20.0)];
  6. [MyScrollViewObj setScrollEnabled:YES];
  7. [MyScrollViewObj setPagingEnabled:YES];
  8. [MyScrollViewObj setShowsHorizontalScrollIndicator:NO];
  9. [MyScrollViewObj setShowsVerticalScrollIndicator:NO];
  10. // Add objects to scroll view
  11. CGFloat y = 0;
  12. for (NSInteger i = 0; i < 20; i++) {
  13. UILabel *l = [[UILabel alloc] initWithFrame:CGRectMake(y, 0, 150.0, 20.0)];
  14. NSString *text = [NSString stringWithFormat:@"Label %d", i];
  15. NSLog(@"Creating label with text: %@", text);
  16. [l setText:text];
  17. [MyScrollViewObj addSubview:l];
  18. [l release];
  19. y = y + 160;
  20. }
  21. // Add scroll to window
  22. [window addSubview:MyScrollViewObj];
  23. [MyScrollViewObj release];
  24. // END ScrollView Test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement