Archive

Posts Tagged ‘Objective-C’

Using Google Chart in Objective-C

April 14, 2012 1 comment

Google chart is a very nice tool where you can generate some very nice figures for your data. By calling their API, you could simply embed it into your web page or download the image for whatever you use. At their website, google includes some most commonly used ones, but some are missing such as meter bar. You could probably find others that fit your goal by just ‘googling’ 🙂

Here’s a code snip for how to use it in Objective-C. I use chf=bg,s,65432100 to make it a clear/transparent background.


- (UIImage *) getGoogleChartImage {

NSString* url=@"http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World&chf=bg,s,65432100";
NSString *myurl=[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:myurl] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];

NSURLResponse* response;
NSError* error;
NSData *googleImageData=[NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];

NSLog(@"%@",error);
NSLog(@"%@",response);
NSLog(@"%@",googleImageData);

UIImage *googleImage = [[UIImage alloc] initWithData:googleImageData];
NSLog(@"Retrived Google Image Width: %f", googleImage.size.width);

return googleImage;
}

Advertisements

Tutorial Sites For iOS Developer

April 7, 2012 Leave a comment

Cocoa & Objective-C is the base of Mac Os X.
Objective-C Language is an extensive to C and makes C OO(Object Oriented).

ObjectiveC Quick Learning:

http://cocoadevcentral.com/d/learn_objectivec/

ObjectiveC Tutorial:

http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html

http://www.raywenderlich.com/tutorials    ( very cool one)

How to generate certificat signing request ( I like their QA part, include a lot of basic points you will need to start your ios development):

http://ibuildapp.com/faq-ipad/#13

The developer video site:

https://developer.apple.com/videos/wwdc/2010/

Delegate is sth like callback function or notify mechanism. When some events happens, we call the corresponding method defined in the delegate class. As to application delegate, the delegate object specified in the UIApplicationMain is responsible to respond to the event which will affect the whole application. For example, when the application is about to run out of memory, the method ‘didReceiveMemoryWarning’ is invoked, and this is defined by an ObjectiveC protocal——UIApplicationDelegate. This protocal defines when and which delegate method should be invoked. For an application delegate class, it should declare in its .h file that it will implement a certain protocal , and then implement all the method which was not taged with ‘optional’ in the protocal.

For example:
There are a lot of other delegate protocal defined in the iPhone. If we want to implement some delegate class to handle certain events generated from a text field in the UI, we can choose UITextFieldDelegate protocal. This protocal defines the methods which will be invoked by the events which are generated by a text, like content changed.
The last thing we need to do is to assign the delegate class of a certain control or view with the delegate class we just implemented.

Some useful links:

http://cocoadevcentral.com/d/intro_to_quartz_two/

iPhone Camera Focussing:

http://stackoverflow.com/questions/8065422/iphone-camera-focussing

AVVCam:

http://developer.apple.com/library/ios/#samplecode/AVCam/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010112-Intro-DontLinkElementID_2

http://red-glasses.com/index.php/tutorials/ios4-take-photos-with-live-video-preview-using-avfoundation/
http://www.musicalgeometry.com/?p=1273

OpencvFrameWork for iOS:

http://aptogo.co.uk/2011/09/opencv-framework-for-ios/

UIColor CheatSheet:  ~~~ I love this one 🙂

http://foobarpig.com/iphone/uicolor-cheatsheet-color-list-conversion-from-and-to-rgb-values.html

The Coordinates of CGRectMake

Categories: MacOS, Programming, Video Tags: ,