Friday, 29 March 2013

Adding scroll view page

After looking at the great design of a Japanese app for London tube in my recent post, I decide to add in the slide page on my London app too.

The idea is to slide from a departure page to arrival page instead from scrolling a long list down the departure to arrival. It is faster and avoid accident tabbing into the route.

It takes me a day. It can be shorter. Most of my mistake is that I forget to link the delegate for my second tableview and that for my scrollview.

My beginning is to search online for code. It turns out apple has a sample code. I find it too complex as it have part for iPad.

My idea is to create 2 tableview in a view controller. The scroll view will switch between the 2 table view. However, it only show one table.

Start at about 2pm, i read about scroll view document from apple. i try a simple project and I got struck by 5 pm. It does not work and I get frustrated. It is a sign to take a break and go sleeping.

When awake, i reflect and think I take a smaller step than creating a simple project. I am thinking of creating just 2 ui view instead a of 2 tableview.

I study the sample project again. This time I understand it. Think about what I am missing. Then I play again on my small project. By 11pm, I already got it working and adding the page control. And submit to iTune by 2 am, and satisfied with my work.

Once I understand the sample code, I can use the scrollview to my case. 2 table and 1 view controller. I was very near to my solution at 5pm. It is only rearranging the tableview and scrollview to be equal level in the nib file. Then add the tables as subview to the scrollview.

It is the same to arrange the page control to be in the view and equal to the scrollview.

I find myself better in using the view now of the view controller.

Not bad for a day work on Good Friday. It is a small step but it makes thing easier.

No comments:

Post a Comment