Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 1.27 KB  |  hits: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. UIscrollview resize problem
  2. CGRect scrollframe = scrollView.frame;
  3.     NSLog(@"scrollframe.height=%f, pick height=%f",scrollframe.size.height, pick.frame.size.height);
  4.     scrollframe.size.height -= pick.frame.size.height;
  5.     [UIView beginAnimations:@"start" context:NULL];
  6.     [UIView setAnimationDuration:0.2];
  7.     [UIView setAnimationBeginsFromCurrentState:YES];
  8.     [scrollView setFrame:scrollframe];
  9.     NSLog(@"scroll height = %f",scrollframe.size.height);
  10.     NSLog(@"scrollview height = %f", scrollView.frame.size.height);
  11.     [pick setFrame:CGRectOffset([pick frame], 0, -220)];
  12.     [UIView commitAnimations];
  13.        
  14. [scrollframe setContentOffset:CGPointMake(scrollframe.contentOffset.x, scrollframe.contentOffset.y-100)];
  15.        
  16. UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
  17. [contentView setBackgroundColor:[UIColor clearColor]];
  18. self.view = contentView;
  19.  
  20. UIScrollView *horizontalScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
  21. [horizontalScroll setBackgroundColor:[UIColor blackColor]];
  22. [horizontalScroll setDelegate:self];
  23. [contentView addSubview:horizontalScroll];
  24.  
  25. UIPickerView *tempPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 220, 320, 100)];
  26. [tempPicker setHidden:YES];
  27. [contentView addSubview:tempPicker];