Scroll to Top Gesture on Multi UIScrollView

If you have more than one UIScrollView inside a view of a ViewController (like this picture), most likely “scroll to top” gesture (by tapping on status bar) won’t cause the UITableView scrolls to toppest row.

Why is that? Inside that view there’re more than one UIScrollViews, as pointed by arrows. As we know, UITableView is a subclass of UIScrollView, so it is a UIScrollView. Inside each cells there’s a UIScrollView. When “scroll to top” gesture happens, the question is which UIScrollView to scroll?

For such UI, we want the UITableView responses to “scroll to top” gesture, while others don’t. There’s super easy solution for that. Are you ready? :-)

Just set “scrollsToTop” property of the UITableView to YES (which is the default), and set “scrollsToTop” property of other UIScrollViews to NO. That’s it!


ID-Objective-C Bandung Meetup – Talking About Storyboard in iOS 5

As a part of offline ID-Objective-C activities and continuation of ID-Objective-Conference 2012 on last February, a meetup was held in Bandung. Held in DyCode office (DyPlex), unfortunately that rare event was only attended by 5 participants. I don’t know that’s because the event was on Saturday (when people might be preparing Saturday night or some may have class as they’re still students), or the iOS platform is still not really interesting for most developers. Or may be nowadays developers are too lazy to learn the most scarce knowledge in Indonesia, knowledge of iOS development. I don’t know. Although there’re many claimed that they’re dying to know about iOS development, yet only 5 persons came :)

Continue reading ID-Objective-C Bandung Meetup – Talking About Storyboard in iOS 5

Consuming and Parsing JSON Service in iOS 5 – The Easy Way

Let’s say I want to get tweets from Twitter.

  • I send HTTP request to Twitter with “Accept” header set to “application/json”
  • Receive returned JSON and parse it
  • Do whatever I want with parsed JSON

Above code uses two API provided only in iOS 5 or later:

  • Asynchronous and block-based handler NSURLConnection
  • NSJSONSerialization

You don’t need any third party libraries.