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

More than UI

on

  • 1,563 views

 

Statistics

Views

Total Views
1,563
Views on SlideShare
920
Embed Views
643

Actions

Likes
1
Downloads
13
Comments
0

5 Embeds 643

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

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

More than UI More than UI Presentation Transcript

  • More than UI Sujith Krishnan 30SS
  • 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
  • Collections – Array & Dictionary
    • Retain the objects
    • Available as mutable and immutable
    • Direct persistence – writeToFile
    • Generic – can hold any objects
  • 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
  • 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];
      • }
  • 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];
      • }
  • Persistence
    • Saving object state to a file
    • Should implement encoding methods
        • Key – Value
        • NSKeyedArchiver
        • NSKeyedUnarchiver
    • Save in document directory
    • Can use SQLite3 also
    • mp
      • temporary files used by f/w
    • Documents
      • user files
    • Library
      • application preferences, settings etc..
    Application Directories
  • 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];
    • }
  • Delegates
    • Define delegate methods
      • @required & @optional
    • Multiple object and single delegate definition
      • Object comparison
      • Use of tag
  • Accelerometer - Hints
  • Format Specifiers
    • Same as what we use for rest of OOP
    • %@ - for NSString , Object , Date etc…
    • Can use positional specifiers
    • IEEE print specifications