Suppose you wanna insert a new row at the bottom of a table. The first thing you need to do is to calculate the content offset. Suppose you already know the height of the new cell, and it’s stored into the variable ‘newCellsHeight’. Then…
CGPoint contentOffset = CGPointZero;
contentOffset.y = _tableView.contentSize.height
Once you’ve calculated the contentOffset (considering the current contentInsets)… you should make sure it’s a non-negative value, to prevent quirks:
// Do we need to scroll down?
if(contentOffset.y > 0.0f)
[_tableView setContentOffset:contentOffset animated:YES];
The last step would be to actually insert the rows. Please, consider that a delay should be applied, so the insert rows animations won’t break the scroll animation!
I’ve been unable to figure out how to do this, actually, within Xcode. But this can also be accomplished by means of this short script:
[cc lang=”bash”]find . “(” -name “*.m” -or -name “*.mm” -or -name “*.cpp” “)” -print | xargs wc -l[/cc]
Google Chrome’s time has come. I love this browser because… it’s the fastest thing out there. It had a lot of glitches when it was first released. I remember Facebook wouldn’t work fine on it… and of course, i had to fix the HTML of many of the websites i maintain.
But i stil love it. It gets updated in background… and you hardly get to notice it!. As almost everything out there… it’s better when tweaked… right?. So i’d like to recommend three different plugins, available in the Chrome Web Store:
As weird as it may sound… popups are still annoying these days. Furthermore, websites with ads are the worst thing that could happen to you. At least while you’re surfing the web. Well, adBlock takes care of that. It just locks out popups, and disable the download of annoying banners. Try it!.
- Google Docs
Wouldn’t it be great to access your google docs, without actually having to hit ‘docs.google.com’ ?. Well, Google Docs plugin allows you to access them right from a shortcut placed by the location bar.
- Firebug Lite
Although it’s not a full version… it’s a lite… FireBug is one of the best plugins out there. It allows you to play, realtime, with the DOM. Just click few buttons, and you can tweak almost anything. Sorry to say this, but Firefox version of this plugin is sooo much better…
I hope this helps!
I’m not really the kind of person that recommends things. Good things stand out by themselves, and if it’s true that they’re good, they actually don’t need sponsorship.
But i feel like this app totally deserves a review. I’ve been using Google Reader for years. Somehow, i got used to its rusty interface. It’s true. A RSS reader doesn’t need to be fancy.. it should just work. But why not make it pretty?
That’s where Capuccino app comes in. It can be found in the Mac Appstore here. It’s free. The UI looks like Mail App for Lion. You get your feeds on the left column… a small column just to its right, and the actual post content to the right. Nice… right?.
Well.. hang in there. The best part of this RSS reader is that it sync’s with Google Reader. So, if you mark something as read in your macbook, it’ll get automatically reflected in your Reader account.
Why i think that this app is way better than NetNewsWire ?. Because it’s simple. It just gets to the point. Enter your credentials and read. Clean UI. Definitely Apple’s style.
Go get it!
If you haven’t done so… go grab the latest release of Xcode. But beware… as soon as you download it, it’ll overwrite your current 4.3 installation. It comes without sdk’s 5.0 and below. So… as usually… i recommend you do that after your looong working journey.
Otherwise you might find yourself stuck watching the download progress bar. No… that didn’t happen to me… i swear!.
Bad thing is that Apple didn’t fix the Refactor functionality, yet. It’s getting kinda difficult to rename class names. For some reason, i keep getting an annoying popup saying that it cannot be done. There are several posts in stackoverflow saying that Dropbox might cause that… but my projects are not inside a Dropbox folder, so that option can be discarded.
If i *ever* figure out how to make it work ok, i promess… i’ll post the solution, right here!