polqf / PQFCustomLoaders

Collection of highly customizable loaders for your iOS projects
MIT License
709 stars 82 forks source link

Loader appearing behind my tableview #1

Closed lfarah closed 9 years ago

lfarah commented 9 years ago

Im setting my loader on viewDidLoad and it appears that it is behind my tableview. To test it, I've set the background to red.

screen shot 2015-01-08 at 9 46 31 am

polqf commented 9 years ago

Hi Ifarah, could you post the code where you instanciate the loader?

Are you using UITableViewController or a UIViewController with a UITableView on top?

lfarah commented 9 years ago

Im using an UIViewController with a UITableView on top

class Categories: UIViewController,UITableViewDataSource,UITableViewDelegate,UISearchBarDelegate {
@IBOutlet weak var tableview: UITableView!
@IBOutlet weak var searchBar: UISearchBar!
@IBOutlet weak var butCancel: UIBarButtonItem!
var bouncingBalls: PQFBouncingBalls!

override func viewDidLoad() 
{
    super.viewDidLoad()
self.bouncingBalls = PQFBouncingBalls(loaderOnView: self.view)
self.bouncingBalls.backgroundColor = UIColor.redColor()
self.bouncingBalls.show()
}
}
polqf commented 9 years ago

So, in that case, you have to add the loader to the table view, because it's the top view of the hierarchy. Now what you are doing is to add it between the view controller and the table view.

The code should look like this: self.bouncingBalls = PQFBouncingBalls(loaderOnView: self.tableView.view)

Try it, and tell me. That's a thing that is going to be solved in the next version.

lfarah commented 9 years ago

The problem on doing this is because once the tableview is scrolled, the bouncingBalls are being scrolled too!

polqf commented 9 years ago

Ok... Let me check it tomorrow, cause today I cannot, and I'll tell you something

lfarah commented 9 years ago

I think I found a way, but I don't think is the right way. I'll test it later. The right way would be making the BouncingBalls always on the front.

-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGRect newFrame = awView.frame;
newFrame.origin.x = 0;
newFrame.origin.y = self.tableView.contentOffset.y+(self.tableView.frame.size.height-kAdWhirlViewHeight);
awView.frame = newFrame;
}
polqf commented 9 years ago

@lfarah Fixed on the new release https://github.com/poolqf/PQFCustomLoaders/releases/tag/1.0.1