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

Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologyDaniel Knell
 
Data20161007
Data20161007Data20161007
Data20161007capegmail
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & RESTHugo Hamon
 
Practical JavaScript Programming - Session 1/8
Practical JavaScript Programming - Session 1/8Practical JavaScript Programming - Session 1/8
Practical JavaScript Programming - Session 1/8Wilson Su
 
Practical JavaScript Programming - Session 8/8
Practical JavaScript Programming - Session 8/8Practical JavaScript Programming - Session 8/8
Practical JavaScript Programming - Session 8/8Wilson Su
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design PatternsHugo Hamon
 
¿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?jaespinmora
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistenceHugo Hamon
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说Ting Lv
 
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 Luc Bors
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboardsDenis Ristic
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First WidgetChris Wilcoxson
 
06 jQuery #burningkeyboards
06 jQuery  #burningkeyboards06 jQuery  #burningkeyboards
06 jQuery #burningkeyboardsDenis Ristic
 
Михаил Крайнюк - 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 AJAXDrupalSib
 
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_bJihoon Kong
 
UITableView Pain Points
UITableView Pain PointsUITableView Pain Points
UITableView Pain PointsKen Auer
 

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, 2009etalcomendras
 
Livre resumes 2007 angeio
Livre resumes 2007 angeioLivre resumes 2007 angeio
Livre resumes 2007 angeiosfa_angeiologie
 
Slides boekpresentatie 'Sociale Media en Journalistiek'
Slides boekpresentatie 'Sociale Media en Journalistiek'Slides boekpresentatie 'Sociale Media en Journalistiek'
Slides boekpresentatie 'Sociale Media en Journalistiek'Bart Van Belle
 
Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009etalcomendras
 
Itf ipp ch04_2012_final
Itf ipp ch04_2012_finalItf ipp ch04_2012_final
Itf ipp ch04_2012_finaldphil002
 
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
 
Paul Harris Fellow Clubs En
Paul Harris Fellow Clubs EnPaul Harris Fellow Clubs En
Paul Harris Fellow Clubs Enetalcomendras
 
Tabagisme et thrombose habbal
Tabagisme et thrombose habbalTabagisme et thrombose habbal
Tabagisme et thrombose habbalsfa_angeiologie
 
Harris & Clark + IceMilk Aprons
Harris & Clark + IceMilk ApronsHarris & Clark + IceMilk Aprons
Harris & Clark + IceMilk ApronsIceMilk Aprons
 
Accomplishment, Aspirations & Challenges: Boston
Accomplishment, Aspirations & Challenges: BostonAccomplishment, Aspirations & Challenges: Boston
Accomplishment, Aspirations & Challenges: BostonThe 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

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) Mobivery
 
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) Mobivery
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative versionWO Community
 
Apple Templates Considered Harmful
Apple Templates Considered HarmfulApple Templates Considered Harmful
Apple Templates Considered HarmfulBrian Gesiak
 
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.UA Mobile
 
Smooth scrolling in UITableView and UICollectionView
Smooth scrolling in UITableView and UICollectionViewSmooth scrolling in UITableView and UICollectionView
Smooth scrolling in UITableView and UICollectionViewAndrea Prearo
 
MVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineMVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineTai Lun Tseng
 
10 tips for a reusable architecture
10 tips for a reusable architecture10 tips for a reusable architecture
10 tips for a reusable architectureJorge Ortiz
 
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 Codejonmarimba
 
iOS Beginners Lesson 4
iOS Beginners Lesson 4iOS Beginners Lesson 4
iOS Beginners Lesson 4Calvin Cheng
 
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 EclipseHeiko Behrens
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App DevelopmentKetan Raval
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCAWhymca
 
MobileCity:Core Data
MobileCity:Core DataMobileCity:Core Data
MobileCity:Core DataAllan 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 (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

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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 interpreternaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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.pdfUK Journal
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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 BusinessPixlogix Infotech
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

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