receive scroll direction, power ios

I have a view that changes if users scrolls it. I need something to read user's scroll data (direction, force etc.) like UITableView does it. if user touches screen and moves finger to the upwards view need to recieve scroll datas to call redraw method. How can I receive scroll data?

Answers


Yes you can get both.

To get the direction of scroll you need to implement - (void)scrollViewDidScroll:(UIScrollView *)scrollView delegate.

int prevValue = 0;
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    int percentScrolled = abs((int)ceil((scrollView.contentOffset.y/scrollView.contentSize.height)*100));

    if(percentScrolled > prevValue)
        NSLog("Scrolling Down");
    else
        NSLog("Scrolling UP");

     prevValue = percentScrolled;
    return;
}

Now to get the force or power of scrolling. you actually need to set something called decelerateRate for your scrollView (or tableView). Refer here.


Need Your Help

Why it's so trouble when I want to insert some instructions in basicblockļ¼Ÿ

insert llvm ir

I found it so trouble when I try to insert some instruction in basicblock.

Closing database connections

.net sql database

To close my database I use this : SqlConnection.Close();

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.