Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  2. CGRect frame = self.floatingView.frame;
  3. frame.origin.y = scrollView.contentOffset.y;
  4. self.floatingView.frame = frame;
  5.  
  6. [self.view bringSubviewToFront:self.floatingView];
  7. }
  8.  
  9. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  10. CGRect frame = self.floatingView.frame;
  11. frame.origin.y = scrollView.contentOffset.y + self.tableView.frame.size.height - self.floatingView.frame.size.height;
  12. self.floatingView.frame = frame;
  13.  
  14. [self.view bringSubviewToFront:self.floatingView];
  15. }
  16.  
  17. [self.navigationController.view addSubview:yourView];
  18.  
  19. UIButton *goToTop = [UIButton buttonWithType:UIButtonTypeCustom];
  20. goToTop.frame = CGRectMake(130, 70, 60, 20);
  21. [goToTop setTitle:@"go to top" forState:UIControlStateNormal];
  22. [goToTop addTarget:self action:@selector(goToTop) forControlEvents:UIControlEventTouchUpInside];
  23. [goToTop setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  24. [goToTop.layer setBorderColor:[[UIColor whiteColor] CGColor]];
  25. goToTop.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:13];
  26. [self.navigationController.view addSubview:goToTop];
  27.  
  28. UIWindow *window = [[UIApplication sharedApplication] keyWindow];
  29. UIButton *btn =[UIButton buttonWithType:UIButtonTypeCustom];
  30. [btn setFrame:CGRectMake(60, 200,40, 60)];
  31. [btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
  32. [window addSubview:btn];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement