1

Introducing SSPullToRefresh — Hi, I’m Sam

 2 years ago
source link: https://soffes.blog/sspulltorefresh
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Introducing SSPullToRefresh — Hi, I’m Sam

Introducing SSPullToRefresh — Hi, I’m Sam

Hi, I’m Sam

This is my blog. I also have a website thing.

Introducing SSPullToRefresh

Posted on May 17, 2012

There are tons of pull to refresh views for iOS on GitHub. Every time I need to add pull to refresh to a project, I end up hacking one of them to pieces. This is silly. I wrote a better one: SSPullToRefresh.

Customizable

SSPullToRefresh is highly customizable. There is a contentView property that allows you to set the view that shows when the user pulls. This is really great because you can simply make a view conforms to the SSPullToRefreshContentView protocol you're good to go. You don't have to hack up the pulling logic.

By default, a basic content view is set if you don't provide one. See the readme for the full details on customizing).

Clean API

You don't have to implement all of the UIScrollViewDelegate methods and forward them. This is silly. SSPullToRefresh uses KVO to track the scrolling. This is all you have to do to add it your scroll view:

[[SSPullToRefreshView alloc] initWithScrollView:self.tableView delegate:self];

That's it. It will automatically add all of the necessary KVO, set its frame, and add itself as a subview at the right spot.

Flexible

You can easily change the height of the view when it's fully expanded by setting the expandedHeight property. Easy as that.

Every pull to refresh view I've ever used doesn't take into account that you may want to change the content inset on your own as well. When you initialize SSPullToRefreshView with a scroll view, it will detect any content inset and make all changes relative to that. If you need to update it later, just set defaultContentInset on your pull to refresh view. Assuming you set it as a property in your view controller, here's what that looks like:

self.pullToRefreshView.defaultContentInset = newContentInset;

Enjoy

I'm using this in Cheddar and several other apps. Not having to hack the internals of a poorly implemented pull to refresh view is really refreshing.

The full source code is on GitHub. Enjoy.

SASS vs LESS

Posted on May 17, 2012

Chris Coyier from CSS Tricks compares LESS to SASS in the most fair post I've seen. His conclusion:

SASS is better on a whole bunch of different fronts, but if you are already happy in LESS, that's cool, at least you are doing yourself a favor by preprocessing.

Most arguments I've read are just "I like SASS better." His is very technical comparison of the two. It's a really interesting read.

Continue reading →

© 2006-2022 Sam Soffes


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK