More than UI
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,611
On Slideshare
959
From Embeds
652
Number of Embeds
5

Actions

Shares
Downloads
13
Comments
0
Likes
1

Embeds 652

http://isujith.wordpress.com 643
http://isujith.wordpress.com. 6
http://webcache.googleusercontent.com 1
http://my.dudamobile.com 1
http://www.linkedin.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. More than UI Sujith Krishnan 30SS
  • 2. Foundation framework
    • Common Classes
      • String NSString NSMutableString
      • Array NSArray NSMutableArray
      • Dictionary NSDict.. NSMutableDict..
      • File Handling NSFileManager
      • Persistance NSKeyedArchiver
      • Thread NSThread
      • Timer NSTimer
      • XML NSXmlParser
      • HTTP Connection NSURLReqest
  • 3. Collections – Array & Dictionary
    • Retain the objects
    • Available as mutable and immutable
    • Direct persistence – writeToFile
    • Generic – can hold any objects
  • 4. Autorelease ???
    • Framework take care of releasing the object
    • Factory methods are autorelease methods
    • Can call autorelease on any object
    • Write methods which will return autorelease objects
  • 5. Autorelease pool
    • Pool of autorelease objects
    • Restrict the scope of autorelease objects
    • Must to use in thread methods
    • Call retain to extend the scope of variable
      • -(void)anyMethod{
      • NSAutoreleasePool *pool = [[NSAuto…
      • // allocate a lot of memory (autorelease)
      • [pool release];
      • }
  • 6. Autorelease - A Scenario
      • (NSString*)someMethod{
      • NSString *stringToReturn = nil;
      • for (int i = 0; i < someLargeNumber; i++) {
      • NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      • NSString *string = ...;
      • string = [string stringByAppendingString:...];
      • if ([string someCondition]) {
      • stringToReturn = [string retain];
      • }
      • [pool release];
      • if (stringToReturn)
      • break;
      • }
      • return [stringToReturn autorelease];
      • }
  • 7. Persistence
    • Saving object state to a file
    • Should implement encoding methods
        • Key – Value
        • NSKeyedArchiver
        • NSKeyedUnarchiver
    • Save in document directory
    • Can use SQLite3 also
  • 8.
    • mp
      • temporary files used by f/w
    • Documents
      • user files
    • Library
      • application preferences, settings etc..
    Application Directories
  • 9. Typical NSThread Use Case
    • - (void)someAction:(id)sender
    • {
    • // Fire up a new thread
    • [NSThread detachNewThreadSelector:@selector(doWork:)
    • withTarget:self object:someData];
    • }
    • - (void)doWork:(id)someData
    • {
    • NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    • [someData doLotsOfWork];
    • // Message back to the main thread
    • [self performSelectorOnMainThread:@selector(allDone:)
    • withObject:[someData result] waitUntilDone:NO];
    • [pool release];
    • }
  • 10. Delegates
    • Define delegate methods
      • @required & @optional
    • Multiple object and single delegate definition
      • Object comparison
      • Use of tag
  • 11. Accelerometer - Hints
  • 12. Format Specifiers
    • Same as what we use for rest of OOP
    • %@ - for NSString , Object , Date etc…
    • Can use positional specifiers
    • IEEE print specifications