SlideShare a Scribd company logo
1 of 41
iOS     Programming:




navigation-based applications
stop 1: Navigation-Based App
        and NSMutableArray
1.1. Create a New project
1.1.UITableViewController




Window       NavigationController   UITableViewController
1.1.UITableViewController




                        UITableViewDataSource   UITableViewDelegate




UITableViewController
UITableViewDataSource

  – tableView:cellForRowAtIndexPath:

  - tableView:numberOfRowsInSection: 

  - tableView:titleForHeaderInSection:

  - numberOfSectionsInTableView:


             UITableViewDelegate

– tableView: didSelectRowAtIndexPath:

- tableView: heightForHeaderInSection

- tableView: viewForHeaderInSection
RootViewController.h
                               NSMutableArray




//     RootViewController.h


#import <UIKit/UIKit.h>

@interface RootViewController : UITableViewController {

       NSMutableArray* data;
}

@property (nonatomic, retain) NSMutableArray* data;

@end
RootViewController.m
                                NSMutableArray




//   RootViewController.m

- (void)viewDidLoad {

     [super viewDidLoad];

     NSMutableArray* tmpArray =
                 [[NSMutableArray alloc]
                 initWithObjects:@”one”, @”two”, @”three”,nil];

     self.data = tmpArray;

     [tmpArray release];
}
RootViewController.m
                            TableViewDataSource




//   RootViewController.m

// Customize the number of sections in the table view.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView
             numberOfRowsInSection:(NSInteger)section {
    return [self.data count];
}
RootViewController.m
                                    TableViewDataSource

    //     RootViewController.m

    // Customize the appearance of table view cells.

    - (UITableViewCell *)tableView:(UITableView *)tableView
                         cellForRowAtIndexPath:(NSIndexPath *)indexPath {

         static NSString *CellIdentifier = @"Cell";

         UITableViewCell *cell = [tableView
                                  dequeueReusableCellWithIdentifier:CellIdentifier];
         if (cell == nil) {
             cell = [[[UITableViewCell alloc]
                     initWithStyle:UITableViewCellStyleDefault
                     reuseIdentifier:CellIdentifier] autorelease];
         }

     // Configure the cell.
     cell.textLabel.text = [self.data objectAtIndex:indexPath.row];
     return cell;

}
RootViewController.m
                            TableViewDataSource




//   RootViewController.m


#import "RootViewController.h"


@implementation RootViewController

@synthesize data;

- (void)dealloc {
    [data release];
    [super viewDidLoad];
}
Test Drive
 version 1.0
Test Drive
what if we have a lot information...
stop 2: Adding Views for Details
       and plist
plist file
(1) plist - initialize



//   RootViewController.m


- (void)viewDidLoad {

     [super viewDidLoad];

     NSString *path = [[NSBundle mainBundle]
                       pathForResource:@"data" ofType:@"plist"];

     NSMutableArray* tmpArray = [[NSMutableArray alloc]
                              initWithContentsOfFile:path];
     self.data = tmpArray;

     [tmpArray release];
}
UIViewController
file.xib
file.h



//     DetailViewController.h


#import <UIKit/UIKit.h>


@interface DetailViewController : UIViewController {

     IBOutlet UILabel *label;

}

@property (nonatomic, retain) UILabel *label;

@end
file.m



//   DetailViewController.m


#import "DetailViewController.h"


@implementation DetailViewController

@synthesize label, text;


- (void)dealloc {

     [super dealloc];
     [label release];
     [text release];

}
                                        and connect the
                                            outlet
stop 3: Link Table and Detail
RootViewController.m

//   RootViewController.m

#import "RootViewController.h"

#import "DetailViewController.h"




- (void)tableView:(UITableView *)tableView
                    didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

     DetailViewController *detailViewController =
        [[DetailViewController alloc]
        initWithNibName:@"DetailViewController"
        bundle:nil];

     [self.navigationController
        pushViewController:detailViewController
        animated:YES];

     [detailViewController release];

}
Now, we have two views!
more and more data...
stop 4: Dictionaries
        and plist
dictionary.plist
RootViewController.m
               create cell from dictionary
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView
                    cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

     UITableViewCell *cell =
              [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
     if (cell == nil) {
         cell = [[[UITableViewCell alloc]
              initWithStyle:UITableViewCellStyleDefault
              reuseIdentifier:CellIdentifier]
              autorelease];
        }

     // Configure the cell.
     // cell.textLabel.text =
     //    [self.data objectAtIndex:indexPath.row];

       cell.textLabel.text =
                 [[self.data objectAtIndex:indexPath.row] objectForKey:@"title"]

    return cell;
}
RootViewController.m

//   RootViewController.m

#import "RootViewController.h"

#import "DetailViewController.h"



- (void)tableView:(UITableView *)tableView
                    didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

     DetailViewController *detailViewController =
        [[DetailViewController alloc]
        initWithNibName:@"DetailViewController"
        bundle:nil];

     [self.navigationController
        pushViewController:detailViewController
        animated:YES];

     detailViewController.row = [self.data objectAtIndex:indexPath.row];

     [detailViewController release];

}
DetailView


NSDictionary *drink;

@property (nonatomic, retain) NSDictionary *drink;

@synthesize row

[drink release];



      - (void) viewWillAppear: (BOOL)animated {
         [super viewWillAppear:animated];

         label.text = [row objectForKey:@"title"];
         text.text = [drink objectForKey:@"desc"];
  }
stop 5: User Experince
        with UITableView
Human Interface Guide
RootViewController.m
 tableView cellForRowAtIndexPath:

cell = [[[UITableViewCell alloc]
initWithStyle: UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];

cell.textLabel.text = [
[self.data objectAtIndex:indexPath.row]
objectForKey:@"title"];


cell.detailTextLabel.text = [
[self.data objectAtIndex:indexPath.row]
objectForKey:@"desc"];
RootViewController.m
 tableView cellForRowAtIndexPath:

cell.imageView.image =
[UIImage imageNamed:@"anyFileName”];


cell.accessoryType =
UITableViewCellAccessoryDisclosureIndicator;
stop 6: Table Group
RootViewController.m
                     Table View - Grouped
// number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)
section {
! if (section == 0) return 2;
! if (section == 1) return 3;
! if (section == 2) return 1;
! else return 0;
}

// section
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:
(NSInteger)section {
! NSString *title = nil;
! switch (section) {
! ! case 0: title = @"Behavioral patterns"; break;
! ! case 1: title = @"Creational patterns"; break;       XIB file:
! ! case 2: title = @"Structural patterns"; break;
! ! default: break;                                      style = grouped
! }
! return title;
}

// number of section
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 3;
}
stop 7: iAds
ExampleAppDelegate.h
                           Adding a common iAds Banner




//     MuralistasAppDelegate.h

#import <UIKit/UIKit.h>

#import <iAd/iAd.h>
#define SharedAdBannerView
((MuralistasAppDelegate *)[[UIApplication sharedApplication] delegate]).banner

@interface MuralistasAppDelegate : NSObject <UIApplicationDelegate> {
   ADBannerView *banner;!
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, retain) ADBannerView *banner;

@end
ExampleAppDelegate.m
                            Adding a common iAds Banner


    // didFinishLaunchingWithOptions

    - (BOOL) application:(UIApplication *)application
             didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        // Add the navigation controller's view to the window and display.
        self.window.rootViewController = self.navigationController;
        [self.window makeKeyAndVisible];

        // Banner
        banner = [[ADBannerView alloc] initWithFrame:CGRectZero];

         // banner is pinned to the bottom
    !   self.banner.autoresizingMask =
            UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight |
            UIViewAutoresizingFlexibleTopMargin;

    !   // Supported landscape or portrait
        [NSSet setWithObjects: ADBannerContentSizeIdentifier320x50,
        ADBannerContentSizeIdentifier480x32, nil];
!
        return YES;
}
<ADBannerViewDelegate>
       iAds Banner




  Add iAds Delegate Methods

               :)
<ADBannerViewDelegate>
       iAds Banner
.javiergs.com

More Related Content

What's hot

前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
Ting Lv
 
Beginning iphone 4_devlopement_chpter7_tab_b
Beginning iphone 4_devlopement_chpter7_tab_bBeginning iphone 4_devlopement_chpter7_tab_b
Beginning iphone 4_devlopement_chpter7_tab_b
Jihoon Kong
 

What's hot (20)

Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 
Data20161007
Data20161007Data20161007
Data20161007
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
 
Practical JavaScript Programming - Session 1/8
Practical JavaScript Programming - Session 1/8Practical JavaScript Programming - Session 1/8
Practical JavaScript Programming - Session 1/8
 
Practical JavaScript Programming - Session 8/8
Practical JavaScript Programming - Session 8/8Practical JavaScript Programming - Session 8/8
Practical JavaScript Programming - Session 8/8
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
 
¿Cómo de sexy puede hacer Backbone mi código?
¿Cómo de sexy puede hacer Backbone mi código?¿Cómo de sexy puede hacer Backbone mi código?
¿Cómo de sexy puede hacer Backbone mi código?
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
06 jQuery #burningkeyboards
06 jQuery  #burningkeyboards06 jQuery  #burningkeyboards
06 jQuery #burningkeyboards
 
Михаил Крайнюк - Form API + Drupal 8: Form and AJAX
Михаил Крайнюк - Form API + Drupal 8: Form and AJAXМихаил Крайнюк - Form API + Drupal 8: Form and AJAX
Михаил Крайнюк - Form API + Drupal 8: Form and AJAX
 
Beginning iphone 4_devlopement_chpter7_tab_b
Beginning iphone 4_devlopement_chpter7_tab_bBeginning iphone 4_devlopement_chpter7_tab_b
Beginning iphone 4_devlopement_chpter7_tab_b
 
UITableView Pain Points
UITableView Pain PointsUITableView Pain Points
UITableView Pain Points
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
 

Viewers also liked

200611 Developing Java web applications
200611 Developing Java web applications 200611 Developing Java web applications
200611 Developing Java web applications
Javier Gonzalez-Sanchez
 
RCMSL Phenomenal Sep 10, 2009
RCMSL Phenomenal Sep 10, 2009RCMSL Phenomenal Sep 10, 2009
RCMSL Phenomenal Sep 10, 2009
etalcomendras
 
Livre resumes 2007 angeio
Livre resumes 2007 angeioLivre resumes 2007 angeio
Livre resumes 2007 angeio
sfa_angeiologie
 
Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009
etalcomendras
 
Itf ipp ch04_2012_final
Itf ipp ch04_2012_finalItf ipp ch04_2012_final
Itf ipp ch04_2012_final
dphil002
 
Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)
lienhard
 
Tabagisme et thrombose habbal
Tabagisme et thrombose habbalTabagisme et thrombose habbal
Tabagisme et thrombose habbal
sfa_angeiologie
 
Accomplishment, Aspirations & Challenges: Boston
Accomplishment, Aspirations & Challenges: BostonAccomplishment, Aspirations & Challenges: Boston
Accomplishment, Aspirations & Challenges: Boston
The Hub Milan
 

Viewers also liked (20)

200611 Developing Java web applications
200611 Developing Java web applications 200611 Developing Java web applications
200611 Developing Java web applications
 
RCMSL Phenomenal Sep 10, 2009
RCMSL Phenomenal Sep 10, 2009RCMSL Phenomenal Sep 10, 2009
RCMSL Phenomenal Sep 10, 2009
 
Terofox v port catalogue (rev.01)
Terofox v port catalogue (rev.01)Terofox v port catalogue (rev.01)
Terofox v port catalogue (rev.01)
 
Livre resumes 2007 angeio
Livre resumes 2007 angeioLivre resumes 2007 angeio
Livre resumes 2007 angeio
 
Monaco 020909
Monaco 020909Monaco 020909
Monaco 020909
 
Slides boekpresentatie 'Sociale Media en Journalistiek'
Slides boekpresentatie 'Sociale Media en Journalistiek'Slides boekpresentatie 'Sociale Media en Journalistiek'
Slides boekpresentatie 'Sociale Media en Journalistiek'
 
Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009
 
Guide To Mba
Guide To MbaGuide To Mba
Guide To Mba
 
Itf ipp ch04_2012_final
Itf ipp ch04_2012_finalItf ipp ch04_2012_final
Itf ipp ch04_2012_final
 
Week9
Week9Week9
Week9
 
201005 accelerometer and core Location
201005 accelerometer and core Location201005 accelerometer and core Location
201005 accelerometer and core Location
 
Eprotect
EprotectEprotect
Eprotect
 
Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)
 
Paul Harris Fellow Clubs En
Paul Harris Fellow Clubs EnPaul Harris Fellow Clubs En
Paul Harris Fellow Clubs En
 
Tabagisme et thrombose habbal
Tabagisme et thrombose habbalTabagisme et thrombose habbal
Tabagisme et thrombose habbal
 
200910 - iPhone at OOPSLA
200910 - iPhone at OOPSLA200910 - iPhone at OOPSLA
200910 - iPhone at OOPSLA
 
Contention
ContentionContention
Contention
 
Eeuwigblijvenleren
EeuwigblijvenlerenEeuwigblijvenleren
Eeuwigblijvenleren
 
Harris & Clark + IceMilk Aprons
Harris & Clark + IceMilk ApronsHarris & Clark + IceMilk Aprons
Harris & Clark + IceMilk Aprons
 
Accomplishment, Aspirations & Challenges: Boston
Accomplishment, Aspirations & Challenges: BostonAccomplishment, Aspirations & Challenges: Boston
Accomplishment, Aspirations & Challenges: Boston
 

Similar to 201104 iphone navigation-based apps

iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
WO Community
 
Apple Templates Considered Harmful
Apple Templates Considered HarmfulApple Templates Considered Harmful
Apple Templates Considered Harmful
Brian Gesiak
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
Heiko Behrens
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCA
Whymca
 
MobileCity:Core Data
MobileCity:Core DataMobileCity:Core Data
MobileCity:Core Data
Allan Davis
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Sarp Erdag
 

Similar to 201104 iphone navigation-based apps (20)

I os 11
I os 11I os 11
I os 11
 
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV) Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
 
Formacion en movilidad: Conceptos de desarrollo en iOS (III)
Formacion en movilidad: Conceptos de desarrollo en iOS (III) Formacion en movilidad: Conceptos de desarrollo en iOS (III)
Formacion en movilidad: Conceptos de desarrollo en iOS (III)
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
 
iOS
iOSiOS
iOS
 
I os 04
I os 04I os 04
I os 04
 
Apple Templates Considered Harmful
Apple Templates Considered HarmfulApple Templates Considered Harmful
Apple Templates Considered Harmful
 
Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.
 
Chainable datasource
Chainable datasourceChainable datasource
Chainable datasource
 
Smooth scrolling in UITableView and UICollectionView
Smooth scrolling in UITableView and UICollectionViewSmooth scrolling in UITableView and UICollectionView
Smooth scrolling in UITableView and UICollectionView
 
MVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineMVVM with SwiftUI and Combine
MVVM with SwiftUI and Combine
 
10 tips for a reusable architecture
10 tips for a reusable architecture10 tips for a reusable architecture
10 tips for a reusable architecture
 
303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code
 
iOS Beginners Lesson 4
iOS Beginners Lesson 4iOS Beginners Lesson 4
iOS Beginners Lesson 4
 
IOS APPs Revision
IOS APPs RevisionIOS APPs Revision
IOS APPs Revision
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App Development
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCA
 
MobileCity:Core Data
MobileCity:Core DataMobileCity:Core Data
MobileCity:Core Data
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
 

More from Javier Gonzalez-Sanchez

More from Javier Gonzalez-Sanchez (20)

201804 SER332 Lecture 01
201804 SER332 Lecture 01201804 SER332 Lecture 01
201804 SER332 Lecture 01
 
201801 SER332 Lecture 03
201801 SER332 Lecture 03201801 SER332 Lecture 03
201801 SER332 Lecture 03
 
201801 SER332 Lecture 04
201801 SER332 Lecture 04201801 SER332 Lecture 04
201801 SER332 Lecture 04
 
201801 SER332 Lecture 02
201801 SER332 Lecture 02201801 SER332 Lecture 02
201801 SER332 Lecture 02
 
201801 CSE240 Lecture 26
201801 CSE240 Lecture 26201801 CSE240 Lecture 26
201801 CSE240 Lecture 26
 
201801 CSE240 Lecture 25
201801 CSE240 Lecture 25201801 CSE240 Lecture 25
201801 CSE240 Lecture 25
 
201801 CSE240 Lecture 24
201801 CSE240 Lecture 24201801 CSE240 Lecture 24
201801 CSE240 Lecture 24
 
201801 CSE240 Lecture 23
201801 CSE240 Lecture 23201801 CSE240 Lecture 23
201801 CSE240 Lecture 23
 
201801 CSE240 Lecture 22
201801 CSE240 Lecture 22201801 CSE240 Lecture 22
201801 CSE240 Lecture 22
 
201801 CSE240 Lecture 21
201801 CSE240 Lecture 21201801 CSE240 Lecture 21
201801 CSE240 Lecture 21
 
201801 CSE240 Lecture 20
201801 CSE240 Lecture 20201801 CSE240 Lecture 20
201801 CSE240 Lecture 20
 
201801 CSE240 Lecture 19
201801 CSE240 Lecture 19201801 CSE240 Lecture 19
201801 CSE240 Lecture 19
 
201801 CSE240 Lecture 18
201801 CSE240 Lecture 18201801 CSE240 Lecture 18
201801 CSE240 Lecture 18
 
201801 CSE240 Lecture 17
201801 CSE240 Lecture 17201801 CSE240 Lecture 17
201801 CSE240 Lecture 17
 
201801 CSE240 Lecture 16
201801 CSE240 Lecture 16201801 CSE240 Lecture 16
201801 CSE240 Lecture 16
 
201801 CSE240 Lecture 15
201801 CSE240 Lecture 15201801 CSE240 Lecture 15
201801 CSE240 Lecture 15
 
201801 CSE240 Lecture 14
201801 CSE240 Lecture 14201801 CSE240 Lecture 14
201801 CSE240 Lecture 14
 
201801 CSE240 Lecture 13
201801 CSE240 Lecture 13201801 CSE240 Lecture 13
201801 CSE240 Lecture 13
 
201801 CSE240 Lecture 12
201801 CSE240 Lecture 12201801 CSE240 Lecture 12
201801 CSE240 Lecture 12
 
201801 CSE240 Lecture 11
201801 CSE240 Lecture 11201801 CSE240 Lecture 11
201801 CSE240 Lecture 11
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

201104 iphone navigation-based apps

  • 1. iOS Programming: navigation-based applications
  • 2. stop 1: Navigation-Based App and NSMutableArray
  • 3. 1.1. Create a New project
  • 4. 1.1.UITableViewController Window NavigationController UITableViewController
  • 5. 1.1.UITableViewController UITableViewDataSource UITableViewDelegate UITableViewController
  • 6. UITableViewDataSource – tableView:cellForRowAtIndexPath: - tableView:numberOfRowsInSection:  - tableView:titleForHeaderInSection: - numberOfSectionsInTableView: UITableViewDelegate – tableView: didSelectRowAtIndexPath: - tableView: heightForHeaderInSection - tableView: viewForHeaderInSection
  • 7. RootViewController.h NSMutableArray // RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController : UITableViewController { NSMutableArray* data; } @property (nonatomic, retain) NSMutableArray* data; @end
  • 8. RootViewController.m NSMutableArray // RootViewController.m - (void)viewDidLoad { [super viewDidLoad]; NSMutableArray* tmpArray = [[NSMutableArray alloc] initWithObjects:@”one”, @”two”, @”three”,nil]; self.data = tmpArray; [tmpArray release]; }
  • 9. RootViewController.m TableViewDataSource // RootViewController.m // Customize the number of sections in the table view. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.data count]; }
  • 10. RootViewController.m TableViewDataSource // RootViewController.m // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell. cell.textLabel.text = [self.data objectAtIndex:indexPath.row]; return cell; }
  • 11. RootViewController.m TableViewDataSource // RootViewController.m #import "RootViewController.h" @implementation RootViewController @synthesize data; - (void)dealloc { [data release]; [super viewDidLoad]; }
  • 13. Test Drive what if we have a lot information...
  • 14. stop 2: Adding Views for Details and plist
  • 16. (1) plist - initialize // RootViewController.m - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"plist"]; NSMutableArray* tmpArray = [[NSMutableArray alloc] initWithContentsOfFile:path]; self.data = tmpArray; [tmpArray release]; }
  • 19. file.h // DetailViewController.h #import <UIKit/UIKit.h> @interface DetailViewController : UIViewController { IBOutlet UILabel *label; } @property (nonatomic, retain) UILabel *label; @end
  • 20. file.m // DetailViewController.m #import "DetailViewController.h" @implementation DetailViewController @synthesize label, text; - (void)dealloc { [super dealloc]; [label release]; [text release]; } and connect the outlet
  • 21. stop 3: Link Table and Detail
  • 22. RootViewController.m // RootViewController.m #import "RootViewController.h" #import "DetailViewController.h" - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; }
  • 23. Now, we have two views!
  • 24. more and more data...
  • 25. stop 4: Dictionaries and plist
  • 27. RootViewController.m create cell from dictionary // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell. // cell.textLabel.text = // [self.data objectAtIndex:indexPath.row]; cell.textLabel.text = [[self.data objectAtIndex:indexPath.row] objectForKey:@"title"] return cell; }
  • 28. RootViewController.m // RootViewController.m #import "RootViewController.h" #import "DetailViewController.h" - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]; [self.navigationController pushViewController:detailViewController animated:YES]; detailViewController.row = [self.data objectAtIndex:indexPath.row]; [detailViewController release]; }
  • 29. DetailView NSDictionary *drink; @property (nonatomic, retain) NSDictionary *drink; @synthesize row [drink release]; - (void) viewWillAppear: (BOOL)animated { [super viewWillAppear:animated]; label.text = [row objectForKey:@"title"]; text.text = [drink objectForKey:@"desc"]; }
  • 30. stop 5: User Experince with UITableView
  • 32. RootViewController.m tableView cellForRowAtIndexPath: cell = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; cell.textLabel.text = [ [self.data objectAtIndex:indexPath.row] objectForKey:@"title"]; cell.detailTextLabel.text = [ [self.data objectAtIndex:indexPath.row] objectForKey:@"desc"];
  • 33. RootViewController.m tableView cellForRowAtIndexPath: cell.imageView.image = [UIImage imageNamed:@"anyFileName”]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  • 34. stop 6: Table Group
  • 35. RootViewController.m Table View - Grouped // number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section { ! if (section == 0) return 2; ! if (section == 1) return 3; ! if (section == 2) return 1; ! else return 0; } // section - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection: (NSInteger)section { ! NSString *title = nil; ! switch (section) { ! ! case 0: title = @"Behavioral patterns"; break; ! ! case 1: title = @"Creational patterns"; break; XIB file: ! ! case 2: title = @"Structural patterns"; break; ! ! default: break; style = grouped ! } ! return title; } // number of section - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 3; }
  • 37. ExampleAppDelegate.h Adding a common iAds Banner // MuralistasAppDelegate.h #import <UIKit/UIKit.h> #import <iAd/iAd.h> #define SharedAdBannerView ((MuralistasAppDelegate *)[[UIApplication sharedApplication] delegate]).banner @interface MuralistasAppDelegate : NSObject <UIApplicationDelegate> { ADBannerView *banner;! } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; @property (nonatomic, retain) ADBannerView *banner; @end
  • 38. ExampleAppDelegate.m Adding a common iAds Banner // didFinishLaunchingWithOptions - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Add the navigation controller's view to the window and display. self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible]; // Banner banner = [[ADBannerView alloc] initWithFrame:CGRectZero]; // banner is pinned to the bottom ! self.banner.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin; ! // Supported landscape or portrait [NSSet setWithObjects: ADBannerContentSizeIdentifier320x50, ADBannerContentSizeIdentifier480x32, nil]; ! return YES; }
  • 39. <ADBannerViewDelegate> iAds Banner Add iAds Delegate Methods :)
  • 40. <ADBannerViewDelegate> iAds Banner