iPhone 4

June 7, 2010

Programming in Objective-C: Q&A

May 21, 2010

Q: How to vertically centre-align the text in textField?
A: [textField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];

Q: How to make a dialogue window (i.e. add textFields) with AlertView?
UIAlertView *describeWP = [[UIAlertView alloc] initWithTitle:@"Add a Waypoint" message:@"\n\n\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Done", nil];
UITextField *wpName = [[UITextField alloc] initWithFrame:CGRectMake(42, 45, 188, 25)];
[wpName setBackgroundColor:[UIColor whiteColor]];
[wpName setPlaceholder:@"Name your waypoint"];
[describeWP addSubview:wpName];
UITextField *wpDescrip = [[UITextField alloc] initWithFrame:CGRectMake(12, 80, 260, 55)];
[wpDescrip setBackgroundColor:[UIColor whiteColor]];
[wpDescrip setPlaceholder:@"Talk about it, e.g. tips, feeling, why excited ..."];
[describeWP addSubview:wpDescrip]
CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0, 90);
[describeWP setTransform:moveUp];
[describeWP show];
[describeWP release];
[wpName release];
[wpDescrip release];

Q: Error: “missing required architecture i386 in file” for each framework.
A: Delete the following line from the project.pbxproj file:
FRAMEWORK_SEARCH_PATHS = ("$(inherited)", "\"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/System/Library/Frameworks\"", );

Q: How to detect the zooming level after the user finger-changed it and let the map keep the level?

Q: When using mapView.showsUserLocation=YES; the error says:

[MKUserLocation annotationType]: unrecognized selector sent to instance

… What is wrong?
A: Put the line: if ([annotation isKindOfClass:MKUserLocation.class]) return nil; in the MKAnnotationView method, then it is fine.
Continue reading

Google Earth – iPhone – Track

May 5, 2010

A KML editor on Windows

Target: save tracks from GPS receiver in the iPhone -> save as a KML or KMZ file -> sent to a desktop with Google Earth -> tracks in KML can be send from desktop to iPhone and show in Googe earth 3-D view.

Suitable framework for iPhone networking programming

April 29, 2010

here: not been ported to iPhone, small changes to the source code are necessary.
here: Omni itself does not use Omninetworking on Mac much, with several failing cases.

cocoahttpserver from code.google (Not apple’s), i.e. Deusty’s: bonjour broadcasting, extremely fast, memory efficient, multi-thread, etc.

Deusty also provides cocoaasyncsocket from code.google:

Another AsyncSocket

Distributed Objects (DO): using DO restricts on cocoa.

Apple’s URL loading system: NSURL

Cocoa stream programming: if you want to code your own protocol.

some discussions on stackoverflow

Iphone application developer resources

April 19, 2010

I will keep posting good resources for Iphone application developers:

  • Work with tables, with UITableView :
  • multi-line with different fonts in UITableViewCell
    http://www.shrinkrays.net/articles/monotouch-controllers-by-example/uitableviewcontroller-by-example.aspx : with advanced options
    http://osmorphis.blogspot.com/2009/04/putting-button-in-table.html : for buttons without the button shape, cell-based button

  • Work with images:
  • http://iphone.zcentric.com/2008/08/28/using-a-uiimagepickercontroller/

  • programming videos:

  • http://www.equeltech.com./

    Continue reading

    iPhone and iTouch can multi-task from Summer

    April 8, 2010

    Apple allows its iPhone to multi-task from this summer with its release of iPhone OS 4, and the platform will also allow developers to put adverts in their applications, and receive 60% revenue! See here for more details.

    Joomla CMS

    March 30, 2010

    Chrono forms: http://www.chronoengine.com/tutorials/chronoforms-j15-tutorials.html
    I have worked out how to save field data from Chrono forms for event registration into a spreadsheet, with the help of this link.

    Good GPS application EveryTrail

    March 29, 2010

    EveryTrail for the moment is the best iPhone application for tracking and recording route so far, in my experience.

    Feel free to put comment on, about other Location relevant iPhone or web applications.

    capture your feeling and universe

    March 22, 2010

    I am going to translate the talk below (what attract me are the idea of capturing how people feel, look for, and do things):

    I also have a blog site in Chinese (中文博客)

    March 18, 2010

    I also have a blog site in Chinese (中文博客):