SlideShare una empresa de Scribd logo
1 de 10
Descargar para leer sin conexión
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
                        .

Más contenido relacionado

Similar a 아이폰강의(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
 

Similar a 아이폰강의(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
 

Más 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
 

Más 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)
 

Último

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 

Último (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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.
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 

아이폰강의(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 .