Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1.  
  2. - (void)viewDidLoad {
  3. [super viewDidLoad];
  4.  
  5. _view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
  6. _view.backgroundColor = [UIColor greenColor];
  7. [self.view addSubview:_view];
  8.  
  9. _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1000, 500)];
  10. _contentView.backgroundColor = [UIColor orangeColor];
  11. [_scrollView addSubview:_contentView];
  12.  
  13. _scrollView.contentSize = _contentView.bounds.size;
  14. _scrollView.scrollEnabled = YES;
  15.  
  16. _textView = [[TSTextView alloc] initWithFrame:CGRectMake(50, 50, 100, 50)];
  17. _textView.text = @"Hallo dit is een test redrawing.";
  18. _textView.backgroundColor = [UIColor clearColor];
  19. _textView.textColor = [UIColor redColor];
  20. _textView.font = [UIFont fontWithName:@"Helvetica" size:20];
  21.  
  22. UITextView *label = [[UITextView alloc] initWithFrame:CGRectMake(50, 50, 100, 50)];
  23. label.text = @"Hallo dit is een test.";
  24. label.backgroundColor = [UIColor clearColor];
  25. label.textColor = [UIColor purpleColor];
  26. label.font = _textView.font;
  27. [_contentView addSubview:label];
  28. [_contentView addSubview:_textView];
  29.  
  30. _textRenderView = [[TSTextRenderView alloc] initWithFrame:CGRectMake(50, 100, 100, 50)];
  31. _textRenderView.text = @"LOLWHUT";
  32. [_contentView addSubview:_textRenderView];
  33. }
  34.  
  35. #pragma mark ScrollView Delegates
  36.  
  37. - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
  38. _textView.contentScaleFactor = scale;
  39. [_textView setNeedsDisplay];
  40.  
  41. _textRenderView.contentScaleFactor = scale;
  42. [_textRenderView setNeedsDisplay];
  43. }
  44.  
  45. - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
  46. return _contentView;
  47. }
  48.  
  49.  
  50. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement