Thursday, June 30, 2011

Tic-tac-toc game almost ready

My first tic-tac-tao game almost ready. Got some break through with the logic yesterday. The 2 players mode is working perfectly (I think), still have some problems with the 1 player mode. As the "AI" for the computer player can only as smart/dumb as the person who wrote it. So if you found the computer player not smart enough, then it's entirely my fault ha ha...Will try to get it done in the next few days. Now, how do I attach a file in this blogger.com blog thing? Looks like I might have to setup Google Docs or something like that? Let's wait and see...

Tuesday, June 28, 2011

Question: What does this "^" symbol mean?

Saw a few tutorials (e.g. this one from the App Code Blog) using this "new" method for animation that works only on iOS4 and above... Don't quite understand what the hell does that "^" symbol mean.... Looks like still got lots of things to learn...    [UIView animateWithDuration:0.5 delay:0.0 options: UIViewAnimationCurveEaseOut                     animations:^     {         navigationBar.frame = navBarFrame;     }                     completion:^(BOOL...

Crash caused by missing ":"

Was testing an array of buttons all using the same "buttonPressed" method to handle the click action, and based on tag value to work out which button been clicked. It keep crashing whenever I clicked any of the buttons and couldn't work out why.    UIButton *button;        [self createNormalButton: button                       atPosX: locX                      atPosY: locY           ...

How to hide the status bar by code

This might be a simple one, and mostly been done by changing the plist file. Saw this example using code to hide the status bar on the top of the screen, so quickly note it down in case I need to use/find it again in the future...- (void)applicationDidFinishLaunching:(UIApplication *)application {         [application setStatusBarHidden:YES];        [window addSubview:viewController.view];    [window makeKeyAndVisible...

Monday, June 27, 2011

First working No NIB (NIBless) Drawing project using Quartz 2D

It took me a while after looking at different examples on the net and books - finally got it working. My first No NIB Drawing project using Quartz 2D.The whole project code as below. Also learned from book to use "#define" to declare the MAX_X and MAX_Y values. May be if running the same code on different devices with different resolution (iPad, iPhone X, ...etc) or when user turned the device into different orientation can somehow work out the Max resolution and adjust it accordingly in the future?And...

Saturday, June 25, 2011

Question: Differences in handling touch event between UIView and UIImageView?

I was studying about the "touch" events on iOS4 and looking at some examples from various areas, including books and net. Have a few little projects listed below.Project 1This code below is from chapter 8 of iPhone Developer's cookbook 2nd Edition by Erica Sadun. I quite like Erica's style of putting everything in one single "main.m" file, may be not suitable for bigger projects but this is definitely less confusing for beginners like me. You can see it uses a "UIImageView" class...

Page 1 of 66712345Next