Wednesday, October 13, 2010

13 October 2010

Completed the basic functionalities of Hello Poly part 2 (assignment 3). Played around with views and drawing polygons onto the view. It was kinda confusing at first, but once the flow was defined properly, everything fit into place. Learnt how to make use of NSUserDefaults too. At least now I know why some iPhone applications are able to resume my previous sessions.

Tried working on the extra credits. Still have no idea how to set the gradients. More research to be done! Gonna continue with the extra credits part after lunch.

Time now: 12 pm, lunch time!


Back from lunch... 12.40 pm. Ate at the hawker centre opposite Fusionopolis with Zac. It's really affordable! No wonder so many people were there when we arrived.


Completed assignment 3! Learnt quite a number of new things through this assignment. Had quite a tough time trying to figure out the rotation of the polygon. At first, I placed the code at the wrong place, and the whole view rotated about the origin (0, 0). Then once I shifted the code to a more appropriate position (after CGContextBeginPath(context);), the polygon rotated, however, still about the origin. Looked up on the documentations and after some searching on Google, I realized that in order to get the polygon to somehow rotate on it's center, this has to be done:

CGContextTranslateCTM(context, CGRectGetMidX(rect), CGRectGetMidY(rect));
CGContextRotateCTM(context, (angleToRotate * M_PI / 180));
CGContextTranslateCTM(context, -(CGRectGetMidX(rect)), -(CGRectGetMidY(rect)));

Shared with Zac on how to do this, and he shared with me on how to draw grid lines in the background (:

Also learnt how to play with animations. It really makes the whole interface look better. Before the implementation of the animations, I had my controls clustered due to the small display for the iPhone. Thought that it would be really difficult from my past experiences with Silverlight and WPF. But true to what Kevin said, it was really simple. Just 4 or 5 lines of code and we're set!




Kevin talked to us regarding where we could get help when we encounter problems during development:
- Manuals (iOS Development Guide)
- Apple Documentation (through Xcode)
- Forums (e.g. Stack Overflow)

Gonna spend some time to read up on the manuals to learn more about the basics.

No comments:

Post a Comment