Your SlideShare is downloading. ×
0
More than UI
More than UI
More than UI
More than UI
More than UI
More than UI
More than UI
More than UI
More than UI
More than UI
More than UI
More than UI
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

More than UI

1,298

Published on

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,298
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
14
Comments
0
Likes
1
Embeds 0
No embeds

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

×