I Have created a view and added to subview of UITableview -
topView = UIView(frame: CGRectMake(0, 250, self.myTableView.frame.width, 44))
topView.backgroundColor = UIColor.redColor()
self.view.addSubview(topView)
self.view.bringSubviewToFront(topView)
self.myTableView.contentInset = UIEdgeInsetsMake(294, 0, 0, 0)
Now I want to scroll this view to the bottom of navigationBar
so I have written scrollview
delegete method-
func scrollViewDidScroll(scrollView: UIScrollView){
var rect:CGRect = topView.frame;
if myTableView.contentOffset.y <= -98 {
rect.origin.y = (myTableView.contentOffset.y * -1) - rect.size.height
topView.frame = rect
}
}
=> Here try following code..
UIView *myProgView = (UIView *)self.progView; //progView is a method that returns a UIView
[self.tableView insertSubview:myProgView aboveSubview:self.tableView];
[self.tableView bringSubviewToFront:myProgView];
=> do tableView Scroll position :
if numberOfRows > 0 {
let indexPath = NSIndexPath(forRow: numberOfRows-1, inSection: (numberOfSections-1))
self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: animated)
}
Now i am able to scrolling my desired view into the tableview section.
Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.