Sunday, May 22, 2011

iOS App Development Fundamentals

Objective-C
  1. If you have understanding in C language and OO design, this is a wonderful quick introduction to all basics of Obj-C you need to know:
    http://cocoadevcentral.com/d/learn_objectivec/
  2. If you need to go further and have time, see this (chinese version)
    http://www.otierney.net/objective-c.html.zh-tw.big5

Xcode and Interface Builder
- Most of the time, in iOS app development, you deals with different views, controllers and nib/xib files. It is important to know what they are at the beginning.
  1. View Controller Basics
    http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/AboutViewControllers/AboutViewControllers.html#//apple_ref/doc/uid/TP40007457-CH112-SW10
  2. Resource Programming Guides - Nib File, File's Owner, Delegate Object
    http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW8
  3. Fundamental Design Pattern
    http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhone101/Articles/02_DesignPatterns.html#//apple_ref/doc/uid/TP40007514-CH10-SW1
  4. Cocoa Design Pattern
    http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html#//apple_ref/doc/uid/TP40002974-CH6-SW6
  5. Creating a Working Nib File With Interface Builder
    http://iphone-obsessed.blogspot.com/2009/02/creating-working-nib-file-with.html


Some ideas:
  1. In IB, File's Owner, First Responder and Delegate are all proxy objects, not real!

Tips:

  1. To get the screen size

  • float w = self.view.frame.size.width;
  • CGRect rect = [[UIScreen mainScreen] bounds];
    NSLog(@"The height is %f", rect.size.height);

Friday, May 20, 2011

Shortcuts and Tips for Xcode and Mac

For Xcode

  1. command + s = save
  2. command + c = copy
  3. command + v = paste
  4. command + z = undo
  5. shift + esc = show completion list
  6. ctrl + . = show next completion
For Mac:
  1. command + shift + 3 = capture full screen
  2. command + shirt + 4 = capture part of a screen

Configure CodeIgniter and LAMP in Ubuntu

The following steps describe the configuration I used in this setup.

  1. Install Ubuntu 10.04 (desktop edition)
  2. Set up openssh and LAMP (optionally install phpmyadmin or mysql administrator)
    # apt-get install openssh-server
    # apt-get install lamp^
  3. Download the latest CodeIgniter (CI) and unpack it in your web root directory.
    http://codeigniter.com/user_guide/installation/index.html
  4. To restart apache and mysql, run this:
    # /etc/init.d/apache2 restart
    or
    # sudo service apache2 restart
    # sudo service mysql restart
  5. Now you can test your CI welcome page (assume you unpack it into a subfolder "ci"):
    www.yourdomain.com/ci/
    www.yourdomian.com/ci/index.php                               (default delegate)
    www.yourdomian.com/ci/index.php/welcome/               (welcome is the default controller class)
    www.yourdomian.com/ci/index.php/welcome/index/      (index is the default function in the controller)
  6. All urls above should go to the same destination, a welcome page.
  7. Now use the mod_rewrite module of apache to remove the ugly index.php in the urls:
    http://codeigniter.com/wiki/mod_rewrite/
  8. The procedures there are basically fine with a few modifications to fit my configuration.
  9. This is my modified .htaccess file put under my "ci" folder (you got to rename it yourself):
    http://dl.dropbox.com/u/908171/blog/blogger/codeigniter-url-rewrite_.htaccess
  10. This is my apache extra config file put under /etc/apache2/conf.d/
    http://dl.dropbox.com/u/908171/blog/blogger/codeigniter-url-rewrite
  11. One thing omitted in the document is that you need to remove the .htaccess comes with the default installation inside the "application" and "system" subfolder in "ci". That two files are invalid and will cause the mod_rewrite working improperly.
  12. Now it's done. You can access your CI controller in the following way:
    www.yourdomain.com/ci/welcome/
  13. Thanks God and the CI team!