Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- CGRect frame = self.floatingView.frame;
- frame.origin.y = scrollView.contentOffset.y;
- self.floatingView.frame = frame;
- [self.view bringSubviewToFront:self.floatingView];
- }
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- CGRect frame = self.floatingView.frame;
- frame.origin.y = scrollView.contentOffset.y + self.tableView.frame.size.height - self.floatingView.frame.size.height;
- self.floatingView.frame = frame;
- [self.view bringSubviewToFront:self.floatingView];
- }
- [self.navigationController.view addSubview:yourView];
- UIButton *goToTop = [UIButton buttonWithType:UIButtonTypeCustom];
- goToTop.frame = CGRectMake(130, 70, 60, 20);
- [goToTop setTitle:@"go to top" forState:UIControlStateNormal];
- [goToTop addTarget:self action:@selector(goToTop) forControlEvents:UIControlEventTouchUpInside];
- [goToTop setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [goToTop.layer setBorderColor:[[UIColor whiteColor] CGColor]];
- goToTop.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:13];
- [self.navigationController.view addSubview:goToTop];
- UIWindow *window = [[UIApplication sharedApplication] keyWindow];
- UIButton *btn =[UIButton buttonWithType:UIButtonTypeCustom];
- [btn setFrame:CGRectMake(60, 200,40, 60)];
- [btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
- [window addSubview:btn];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement