SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
Chapter 8
               Custom TableView Cell
                      Bit Academy
•
               • NIB                   .

               • NIB   Top Level           .

               •                   .
•                          ,
                   ,                          .

               •
                       .

               •               UITableViewCell


                           .
IB



               NIB
NIB

•        File->New              IOS      User Interface               View
         Next          PhotoTableCell

•        PhotoTableCell.xib

•        PhotoTableCell.xib             IB      View              TableViewCell
                    TableViewCell                  UIImageView, UILabel
                               .

•        UIImageView                         Mode         Aspect To Fit
           .
•          IB

               •                      IB       IBOutlet property


               •   viewWithTag:

               •   Tag            0        .
•   tableView: cellForRowAtIndexPath:
                           , PhotoTableCell.nib         tag


               •   nib                   (
                      )

               •                       [NSBundle mainBundle]
NSBundle Class
               •   NSBundle
                                           .

               •   mainBundle :
                   NSBundle                    . + (NSBundle *)mainBundle

               •   - (NSArray *)loadNibNamed:(NSString *)name owner:
                   (id)owner options:(NSDictionary *)options

                   name                                       category NSBundle
                   nib            The name of the nib file, which need not include
                the .nib extension.
               owner :nib        File's Owner object.
               options : A dictionary containing the options to use when
          opening the nib file. For a list of available keys for this dictionary, see
          “Nib File Loading Options. Nib                Toplevel
                             (                               root View 0
                .)
tableView: cellForRowAtIndexpath:
          - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
              return [[self appDelegate].photoArray count];
          }

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

                   static NSString *CellIdentifier = @"Cell";

              UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
              if (cell == nil) {
                  //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
          reuseIdentifier:CellIdentifier] autorelease];
                  NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"PhotoTableCell" owner:self
          options:nil];
                  cell = [topLevelObjects objectAtIndex:0]; //
              }

          !   NSDictionary *photoData = [[self appDelegate].photoArray objectAtIndex:indexPath.row];
          !
          !   // cell.textLabel.text = [photoData valueForKey:@"Country"];
          !   // cell.detailTextLabel.text = [photoData valueForKey:@"Region"];
          !   // cell.imageView.image = [photoData valueForKey:@"Thumbnail"];

                   UIImageView *imageView = (UIImageView *) [cell viewWithTag:1];
                   imageView.image = [photoData valueForKey:@"Thumbnail"];

                   UILabel *label;
                   label = (UILabel *) [cell viewWithTag:2];
                   label.text = [photoData valueForKey:@"Country"];

                   label = (UILabel *) [cell viewWithTag:3];
                   label.text = [photoData valueForKey:@"Region"];

          !   cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

                   return cell;
          }
•   RootViewController.xib   Tableview   Row
                   height PhotoTableCell.xib height
                        .

Contenu connexe

Similaire à 아이폰강의(6) pdf

아이폰강의(5) pdf
아이폰강의(5) pdf아이폰강의(5) pdf
아이폰강의(5) pdfsunwooindia
 
Introducing collection views - Mark Pospesel
Introducing collection views - Mark PospeselIntroducing collection views - Mark Pospesel
Introducing collection views - Mark PospeselJigar Maheshwari
 
April iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationApril iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationLong Weekend LLC
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development Alberto De Bortoli
 
Look Again at the ZCA
Look Again at the ZCALook Again at the ZCA
Look Again at the ZCAmikerhodes
 
Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextMugunth Kumar
 
Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Saulo Arruda
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Michael Shrove
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's NewNascentDigital
 
iOS 上 self-sizing cell 的過去、現在、與未來
iOS 上 self-sizing cell 的過去、現在、與未來iOS 上 self-sizing cell 的過去、現在、與未來
iOS 上 self-sizing cell 的過去、現在、與未來Jeff Lin
 
Freebase and the iPhone
Freebase and the iPhoneFreebase and the iPhone
Freebase and the iPhoneAlec Flett
 
Stoop 301-internal objectstructureinvw
Stoop 301-internal objectstructureinvwStoop 301-internal objectstructureinvw
Stoop 301-internal objectstructureinvwThe World of Smalltalk
 

Similaire à 아이폰강의(6) pdf (20)

I os 04
I os 04I os 04
I os 04
 
Couchbase Talk
Couchbase TalkCouchbase Talk
Couchbase Talk
 
201104 iphone navigation-based apps
201104 iphone navigation-based apps201104 iphone navigation-based apps
201104 iphone navigation-based apps
 
아이폰강의(5) pdf
아이폰강의(5) pdf아이폰강의(5) pdf
아이폰강의(5) pdf
 
Introducing collection views - Mark Pospesel
Introducing collection views - Mark PospeselIntroducing collection views - Mark Pospesel
Introducing collection views - Mark Pospesel
 
April iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationApril iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance Presentation
 
IOS APPs Revision
IOS APPs RevisionIOS APPs Revision
IOS APPs Revision
 
IOS Storyboards
IOS StoryboardsIOS Storyboards
IOS Storyboards
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development
 
Look Again at the ZCA
Look Again at the ZCALook Again at the ZCA
Look Again at the ZCA
 
Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreText
 
Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4
 
iOS: View Controllers
iOS: View ControllersiOS: View Controllers
iOS: View Controllers
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)
 
IOS- Designing with ui tool bar in ios
IOS-  Designing with ui tool bar in iosIOS-  Designing with ui tool bar in ios
IOS- Designing with ui tool bar in ios
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's New
 
занятие6
занятие6занятие6
занятие6
 
iOS 上 self-sizing cell 的過去、現在、與未來
iOS 上 self-sizing cell 的過去、現在、與未來iOS 上 self-sizing cell 的過去、現在、與未來
iOS 上 self-sizing cell 的過去、現在、與未來
 
Freebase and the iPhone
Freebase and the iPhoneFreebase and the iPhone
Freebase and the iPhone
 
Stoop 301-internal objectstructureinvw
Stoop 301-internal objectstructureinvwStoop 301-internal objectstructureinvw
Stoop 301-internal objectstructureinvw
 

Plus de sunwooindia

2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서sunwooindia
 
2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서sunwooindia
 
2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서sunwooindia
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdfsunwooindia
 
아이폰강의(3)
아이폰강의(3)아이폰강의(3)
아이폰강의(3)sunwooindia
 
아이폰프로그래밍(2)
아이폰프로그래밍(2)아이폰프로그래밍(2)
아이폰프로그래밍(2)sunwooindia
 
오브젝트C(pdf)
오브젝트C(pdf)오브젝트C(pdf)
오브젝트C(pdf)sunwooindia
 

Plus de sunwooindia (7)

2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서
 
2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서
 
2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서2011년 상반기 스마트폰이용실태조사 요약보고서
2011년 상반기 스마트폰이용실태조사 요약보고서
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdf
 
아이폰강의(3)
아이폰강의(3)아이폰강의(3)
아이폰강의(3)
 
아이폰프로그래밍(2)
아이폰프로그래밍(2)아이폰프로그래밍(2)
아이폰프로그래밍(2)
 
오브젝트C(pdf)
오브젝트C(pdf)오브젝트C(pdf)
오브젝트C(pdf)
 

Dernier

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 

Dernier (20)

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 

아이폰강의(6) pdf

  • 1. Chapter 8 Custom TableView Cell Bit Academy
  • 2. • NIB . • NIB Top Level . • .
  • 3. , , . • . • UITableViewCell .
  • 4. IB NIB
  • 5. NIB • File->New IOS User Interface View Next PhotoTableCell • PhotoTableCell.xib • PhotoTableCell.xib IB View TableViewCell TableViewCell UIImageView, UILabel . • UIImageView Mode Aspect To Fit .
  • 6. IB • IB IBOutlet property • viewWithTag: • Tag 0 .
  • 7. tableView: cellForRowAtIndexPath: , PhotoTableCell.nib tag • nib ( ) • [NSBundle mainBundle]
  • 8. NSBundle Class • NSBundle . • mainBundle : NSBundle . + (NSBundle *)mainBundle • - (NSArray *)loadNibNamed:(NSString *)name owner: (id)owner options:(NSDictionary *)options name category NSBundle nib The name of the nib file, which need not include the .nib extension. owner :nib File's Owner object. options : A dictionary containing the options to use when opening the nib file. For a list of available keys for this dictionary, see “Nib File Loading Options. Nib Toplevel ( root View 0 .)
  • 9. tableView: cellForRowAtIndexpath: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [[self appDelegate].photoArray count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"PhotoTableCell" owner:self options:nil]; cell = [topLevelObjects objectAtIndex:0]; // } ! NSDictionary *photoData = [[self appDelegate].photoArray objectAtIndex:indexPath.row]; ! ! // cell.textLabel.text = [photoData valueForKey:@"Country"]; ! // cell.detailTextLabel.text = [photoData valueForKey:@"Region"]; ! // cell.imageView.image = [photoData valueForKey:@"Thumbnail"]; UIImageView *imageView = (UIImageView *) [cell viewWithTag:1]; imageView.image = [photoData valueForKey:@"Thumbnail"]; UILabel *label; label = (UILabel *) [cell viewWithTag:2]; label.text = [photoData valueForKey:@"Country"]; label = (UILabel *) [cell viewWithTag:3]; label.text = [photoData valueForKey:@"Region"]; ! cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell; }
  • 10. RootViewController.xib Tableview Row height PhotoTableCell.xib height .