1
我有一个tableView。在视图上是UIButton。我希望当向下滚动按钮淡入淡出,当滚动停止或向上按钮显示。淡入淡出/向上滚动显示UIButton
代码:
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
NSLog(@"Start scroll");
//I assume the buttons are within your cells so you will have to enable them within your cells so you will probably have to handle this by sending a custom message to your cells or accessing them with properties.
CGRect frame = addCommentBtn.frame;
frame.origin.y = scrollView.contentOffset.y + self.newsTableView.frame.size.height + 4;
addCommentBtn.frame = frame;
[self.view bringSubviewToFront:addCommentBtn];}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
NSLog(@"End scroll");
// do the same to enable them back
CGRect frame = addCommentBtn.frame;
frame.origin.y = scrollView.contentOffset.y + self.newsTableView.frame.size.height + 4;
addCommentBtn.frame = frame;
[self.view bringSubviewToFront:addCommentBtn];}
,但无法正常工作! 谢谢