SlideShare a Scribd company logo
1 of 36
Разработка приложений
   для iPhone и iPad
      занятие #7
план
• ScrollView
• TableView
UIScrollView
Scrolling Examples
Content Size
            контент
                       contentSize.width




  contentSize.height
Content Inset

   contentInset.top




contentInset.bottom
Content Inset           contentSize.width

                                            contentInset.top




   contentSize.height




                                            contentInset.bottom
начало скролла
  Scroll Indicator Insets

scrollIndicatorInsets.top
Content
Offset
contentOffset.x

contentOffset.y
contentSize.width
                                                                contentInset.top




         contentSize.height




                                                                contentInset.bottom
                             contentInset.left       contentInset.right



Saturday, January 30, 2010                                                            16
как использовать?
CGRect frame = CGRectMake(0, 0, 200, 200);
scrollView = [[UIScrollView alloc] initWithFrame:frame];


frame = CGRectMake(0, 0, 500, 500);
myImageView = [[UIImageView alloc] initWithFrame:frame];
[scrollView addSubview:myImageView];


scrollView.contentSize = CGSizeMake(500, 500);
Делегат
          UIScrollViewDelegate

@protocol UIScrollViewDelegate<NSObject>
@optional

- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
...

- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView;
@end
Масштабирование
scrollView.maximumZoomScale = 2.0;
scrollView.minimumZoomScale = scrollView.frame.size.width /
myImage.frame.size.width;



и реализовать метод делегата:

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)view {
  return someViewThatWillBeScaled;
}
Zoom to Rect




                          - (void)setZoomScale:(float)scale animated:(BOOL);

                          - (void)zoomToRect:(CGRect)rect animated:(BOOL);

urday, January 30, 2010                                                        26
TableView
Table View Styles
    UITableViewStylePlain   UITableViewStyleGrouped
анатомия TableView
    Table View Anatomy
               Plain Style

Table Header
                             Section Header


                             Table Cell
                             Section Footer


     Section


Table Footer
анатомия TableView
     Table View Anatomy
               Grouped Style

Table Header
                               Section Header


                               Table Cell
                               Section Footer



     Section



Table Footer
использование
       TableView

• использование делегатов,
  предоставляющих данные
• просит то, что сейчас нужно
UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)table;

- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section;

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath;
Datasource Message Flow
                                    numberOfSectionsInTableView:




                                                 How many
                                                  sections?

                                                       Datasource




Saturday, January 30, 2010                                          41
Datasource Message Flow
                                   tableView:numberOfRowsInSection:




                                                  How many rows
                                                   in section 0?

                                                       Datasource




Saturday, January 30, 2010                                          42
Datasource Message Flow
                                   tableView:cellForRowAtIndexPath:




                                               What to display at
                                               section 0, row 0?

                                                         Datasource




Saturday, January 30, 2010                                            43
NSIndexPath
           •    массив int

           •    секция + строка
           •    [NSIndexPath indexPathForRow:(NSUInteger)row inSection:
                (NSUInteger)section];


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
*)indexPath
{
   UITableViewCell *cell = ...;
   cell.textLabel.text = [myStrings objectAtIndex:indexPath.row]
   return [cell autorelease];
}
reuse - чтобы быстрее :)
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@“MyIdentifier”];
if (cell == nil) {
     cell = [[[UITableViewCell alloc]
     initWithStyle:... reuseIdentifier:@“MyIdenifier”] autorelease];
   }

    cell.text = [myStrings objectAtIndex:indexPath.row]
    return cell;

}

                      identifier - любой
Cell Styles
     initWithStyle                -   UITableViewCellStyle



   UITableViewCellStyleDefault

   UITableViewCellStyleSubtitle




   UITableViewCellStyleValue1

   UITableViewCellStyleValue2
Basic properties
• UITableViewCell has an image view and one or two text labels
  cell.imageView.image = [UIImage imageNamed:@“vitolidol.png”];
  cell.textLabel.text = @“Vitol Idol”;
  cell.detailTextLabel.text = @“Billy Idol”;
Accessory Types
// UITableView delegate method
- (UITableViewCellAccessoryType)tableView:(UITableView *)table
accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath;

 UITableViewCellAccessoryDisclosureIndicator

 UITableViewCellAccessoryDetailDisclosureButton

 UITableViewCellAccessoryCheckmark

- (void)tableView:(UITableView *)tableView
accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
  // Only for the blue disclosure button
  NSUInteger row = indexPath.row;
  ...
}
перезагрузить
- (void)viewWillAppear:(BOOL)animated
{
  [super viewWillAppear:animated];
    [self.tableView reloadData];
}
добавление по ходу
- (void)insertSections:(NSIndexSet *)sections withRowAnimation:
(UITableViewRowAnimation)animation;

- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:
(UITableViewRowAnimation)animation;


- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:
(UITableViewRowAnimation)animation;
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:
(UITableViewRowAnimation)animation;
UITableViewDelegate


• поведение + внешний вид
• логика отдельно от данных!
UITableViewDelegate

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell
*)cell forRowAtIndexPath:(NSIndexPath *)indexPath;




- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:
(NSIndexPath *)indexPath;
обычно...
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*)indexPath {

NSUInteger row = indexPath.row
id objectToDisplay = [myObjects objectAtIndex:row];


MyViewController *myViewController = ...;
myViewController.object = objectToDisplay;
[self.navigationController pushViewController:myViewController animated:YES];

}
UITableViewController
= UITableView + делегаты
Хранение данных
                           Property Lists

•   Property Lists - для небольшого объема

•     Writing an Array to Disk
    хранит обычные форматы данных iOS
      NSArray *array = [NSArray arrayWithObjects:@“Foo”,
                        [NSNumber numberWithBool:YES],
                        [NSDate dateWithTimeIntervalSinceNow:60],
                        nil];
      [array writeToFile:@“MyArray.plist” atomically:YES];


          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
          "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
          <plist version="1.0">
          <array>
           !    <string>Foo</string>
           !    <true/>
           !    <date>2010-02-02T09:26:18Z</date>
          </array>
          </plist>
http://empatika.com
oleg.parinov@empatika.com

More Related Content

Similar to занятие7

Cocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollersCocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollersStijn Willems
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdfsunwooindia
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development Alberto De Bortoli
 
MVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineMVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineTai Lun Tseng
 
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
 
Advanced Swift Generics
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift GenericsMax Sokolov
 
Real World Generics In Swift
Real World Generics In SwiftReal World Generics In Swift
Real World Generics In SwiftVadym Markov
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App DevelopmentKetan Raval
 
APPlause - DemoCamp Munich
APPlause - DemoCamp MunichAPPlause - DemoCamp Munich
APPlause - DemoCamp MunichPeter Friese
 
Scroll views
Scroll viewsScroll views
Scroll viewsSV.CO
 
Declarative UI on iOS without SwiftUI (中文)
Declarative UI on iOS without SwiftUI (中文)Declarative UI on iOS without SwiftUI (中文)
Declarative UI on iOS without SwiftUI (中文)Shih-Ting Huang
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative versionWO Community
 
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...TAISEEREISA
 
Optimize CollectionView Scrolling
Optimize CollectionView ScrollingOptimize CollectionView Scrolling
Optimize CollectionView ScrollingAndrea Prearo
 

Similar to занятие7 (20)

Cocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollersCocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollers
 
IOS APPs Revision
IOS APPs RevisionIOS APPs Revision
IOS APPs Revision
 
I os 04
I os 04I os 04
I os 04
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdf
 
Chainable datasource
Chainable datasourceChainable datasource
Chainable datasource
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development
 
MVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineMVVM with SwiftUI and Combine
MVVM with SwiftUI and Combine
 
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
 
I os 11
I os 11I os 11
I os 11
 
004
004004
004
 
Advanced Swift Generics
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift Generics
 
Real World Generics In Swift
Real World Generics In SwiftReal World Generics In Swift
Real World Generics In Swift
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App Development
 
APPlause - DemoCamp Munich
APPlause - DemoCamp MunichAPPlause - DemoCamp Munich
APPlause - DemoCamp Munich
 
Scroll views
Scroll viewsScroll views
Scroll views
 
Declarative UI on iOS without SwiftUI (中文)
Declarative UI on iOS without SwiftUI (中文)Declarative UI on iOS without SwiftUI (中文)
Declarative UI on iOS without SwiftUI (中文)
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
 
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
 
Optimize CollectionView Scrolling
Optimize CollectionView ScrollingOptimize CollectionView Scrolling
Optimize CollectionView Scrolling
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
 

More from Oleg Parinov

'Real agile' coaching session
'Real agile'   coaching session'Real agile'   coaching session
'Real agile' coaching sessionOleg Parinov
 
Oleg+olga product meetup
Oleg+olga product meetupOleg+olga product meetup
Oleg+olga product meetupOleg Parinov
 
[Технопарк] Управление продуктом-1
[Технопарк] Управление продуктом-1[Технопарк] Управление продуктом-1
[Технопарк] Управление продуктом-1Oleg Parinov
 
[Технопарк] Управление продуктом-2
[Технопарк] Управление продуктом-2[Технопарк] Управление продуктом-2
[Технопарк] Управление продуктом-2Oleg Parinov
 
[Технопарк] Управление продуктом-3
[Технопарк] Управление продуктом-3[Технопарк] Управление продуктом-3
[Технопарк] Управление продуктом-3Oleg Parinov
 
Управление продуктом - 5-я лекция - Технопарк@Mail.Ru
Управление продуктом - 5-я лекция - Технопарк@Mail.RuУправление продуктом - 5-я лекция - Технопарк@Mail.Ru
Управление продуктом - 5-я лекция - Технопарк@Mail.RuOleg Parinov
 
Управление продуктом - Лекция №4
Управление продуктом - Лекция №4Управление продуктом - Лекция №4
Управление продуктом - Лекция №4Oleg Parinov
 
Технопарк - Управление продуктом - Лекция №2
Технопарк - Управление продуктом - Лекция №2Технопарк - Управление продуктом - Лекция №2
Технопарк - Управление продуктом - Лекция №2Oleg Parinov
 
Лекция №2 Курса Product Management в НИУ-ВШЭ
Лекция №2 Курса Product Management в НИУ-ВШЭЛекция №2 Курса Product Management в НИУ-ВШЭ
Лекция №2 Курса Product Management в НИУ-ВШЭOleg Parinov
 
Product management - лекция №1
Product management - лекция №1Product management - лекция №1
Product management - лекция №1Oleg Parinov
 
Презентация проекта In Flow
Презентация проекта In FlowПрезентация проекта In Flow
Презентация проекта In FlowOleg Parinov
 
Pivot + Lean Startup #poSEEDelki Harvest
Pivot + Lean Startup #poSEEDelki HarvestPivot + Lean Startup #poSEEDelki Harvest
Pivot + Lean Startup #poSEEDelki HarvestOleg Parinov
 
Start-up Reality Check - Empatika в ВШЭ
Start-up Reality Check - Empatika в ВШЭStart-up Reality Check - Empatika в ВШЭ
Start-up Reality Check - Empatika в ВШЭOleg Parinov
 
Генетические алгоритмы
Генетические алгоритмыГенетические алгоритмы
Генетические алгоритмыOleg Parinov
 
Четвертое занятие курса iOS-разработки в ГУ-ВШЭ
Четвертое занятие курса iOS-разработки в ГУ-ВШЭЧетвертое занятие курса iOS-разработки в ГУ-ВШЭ
Четвертое занятие курса iOS-разработки в ГУ-ВШЭOleg Parinov
 

More from Oleg Parinov (20)

'Real agile' coaching session
'Real agile'   coaching session'Real agile'   coaching session
'Real agile' coaching session
 
Oleg+olga product meetup
Oleg+olga product meetupOleg+olga product meetup
Oleg+olga product meetup
 
[Технопарк] Управление продуктом-1
[Технопарк] Управление продуктом-1[Технопарк] Управление продуктом-1
[Технопарк] Управление продуктом-1
 
[Технопарк] Управление продуктом-2
[Технопарк] Управление продуктом-2[Технопарк] Управление продуктом-2
[Технопарк] Управление продуктом-2
 
[Технопарк] Управление продуктом-3
[Технопарк] Управление продуктом-3[Технопарк] Управление продуктом-3
[Технопарк] Управление продуктом-3
 
Управление продуктом - 5-я лекция - Технопарк@Mail.Ru
Управление продуктом - 5-я лекция - Технопарк@Mail.RuУправление продуктом - 5-я лекция - Технопарк@Mail.Ru
Управление продуктом - 5-я лекция - Технопарк@Mail.Ru
 
Управление продуктом - Лекция №4
Управление продуктом - Лекция №4Управление продуктом - Лекция №4
Управление продуктом - Лекция №4
 
Технопарк - Управление продуктом - Лекция №2
Технопарк - Управление продуктом - Лекция №2Технопарк - Управление продуктом - Лекция №2
Технопарк - Управление продуктом - Лекция №2
 
Лекция №2 Курса Product Management в НИУ-ВШЭ
Лекция №2 Курса Product Management в НИУ-ВШЭЛекция №2 Курса Product Management в НИУ-ВШЭ
Лекция №2 Курса Product Management в НИУ-ВШЭ
 
Product management - лекция №1
Product management - лекция №1Product management - лекция №1
Product management - лекция №1
 
Презентация проекта In Flow
Презентация проекта In FlowПрезентация проекта In Flow
Презентация проекта In Flow
 
Pivot + Lean Startup #poSEEDelki Harvest
Pivot + Lean Startup #poSEEDelki HarvestPivot + Lean Startup #poSEEDelki Harvest
Pivot + Lean Startup #poSEEDelki Harvest
 
Instagram Design
Instagram DesignInstagram Design
Instagram Design
 
Start-up Reality Check - Empatika в ВШЭ
Start-up Reality Check - Empatika в ВШЭStart-up Reality Check - Empatika в ВШЭ
Start-up Reality Check - Empatika в ВШЭ
 
Генетические алгоритмы
Генетические алгоритмыГенетические алгоритмы
Генетические алгоритмы
 
Squeek school 2
Squeek school 2Squeek school 2
Squeek school 2
 
Squeek 1
Squeek 1Squeek 1
Squeek 1
 
занятие8
занятие8занятие8
занятие8
 
занятие6
занятие6занятие6
занятие6
 
Четвертое занятие курса iOS-разработки в ГУ-ВШЭ
Четвертое занятие курса iOS-разработки в ГУ-ВШЭЧетвертое занятие курса iOS-разработки в ГУ-ВШЭ
Четвертое занятие курса iOS-разработки в ГУ-ВШЭ
 

занятие7

  • 1. Разработка приложений для iPhone и iPad занятие #7
  • 4. Content Size контент contentSize.width contentSize.height
  • 5. Content Inset contentInset.top contentInset.bottom
  • 6. Content Inset contentSize.width contentInset.top contentSize.height contentInset.bottom
  • 7. начало скролла Scroll Indicator Insets scrollIndicatorInsets.top
  • 10. contentSize.width contentInset.top contentSize.height contentInset.bottom contentInset.left contentInset.right Saturday, January 30, 2010 16
  • 11. как использовать? CGRect frame = CGRectMake(0, 0, 200, 200); scrollView = [[UIScrollView alloc] initWithFrame:frame]; frame = CGRectMake(0, 0, 500, 500); myImageView = [[UIImageView alloc] initWithFrame:frame]; [scrollView addSubview:myImageView]; scrollView.contentSize = CGSizeMake(500, 500);
  • 12. Делегат UIScrollViewDelegate @protocol UIScrollViewDelegate<NSObject> @optional - (void)scrollViewDidScroll:(UIScrollView *)scrollView; ... - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView; @end
  • 13. Масштабирование scrollView.maximumZoomScale = 2.0; scrollView.minimumZoomScale = scrollView.frame.size.width / myImage.frame.size.width; и реализовать метод делегата: - (UIView *)viewForZoomingInScrollView:(UIScrollView *)view { return someViewThatWillBeScaled; }
  • 14. Zoom to Rect - (void)setZoomScale:(float)scale animated:(BOOL); - (void)zoomToRect:(CGRect)rect animated:(BOOL); urday, January 30, 2010 26
  • 15.
  • 16. TableView Table View Styles UITableViewStylePlain UITableViewStyleGrouped
  • 17. анатомия TableView Table View Anatomy Plain Style Table Header Section Header Table Cell Section Footer Section Table Footer
  • 18. анатомия TableView Table View Anatomy Grouped Style Table Header Section Header Table Cell Section Footer Section Table Footer
  • 19. использование TableView • использование делегатов, предоставляющих данные • просит то, что сейчас нужно
  • 20. UITableViewDataSource - (NSInteger)numberOfSectionsInTableView:(UITableView *)table; - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
  • 21. Datasource Message Flow numberOfSectionsInTableView: How many sections? Datasource Saturday, January 30, 2010 41
  • 22. Datasource Message Flow tableView:numberOfRowsInSection: How many rows in section 0? Datasource Saturday, January 30, 2010 42
  • 23. Datasource Message Flow tableView:cellForRowAtIndexPath: What to display at section 0, row 0? Datasource Saturday, January 30, 2010 43
  • 24. NSIndexPath • массив int • секция + строка • [NSIndexPath indexPathForRow:(NSUInteger)row inSection: (NSUInteger)section]; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = ...; cell.textLabel.text = [myStrings objectAtIndex:indexPath.row] return [cell autorelease]; }
  • 25. reuse - чтобы быстрее :) - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@“MyIdentifier”]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:... reuseIdentifier:@“MyIdenifier”] autorelease]; } cell.text = [myStrings objectAtIndex:indexPath.row] return cell; } identifier - любой
  • 26. Cell Styles initWithStyle - UITableViewCellStyle UITableViewCellStyleDefault UITableViewCellStyleSubtitle UITableViewCellStyleValue1 UITableViewCellStyleValue2
  • 27. Basic properties • UITableViewCell has an image view and one or two text labels cell.imageView.image = [UIImage imageNamed:@“vitolidol.png”]; cell.textLabel.text = @“Vitol Idol”; cell.detailTextLabel.text = @“Billy Idol”;
  • 28. Accessory Types // UITableView delegate method - (UITableViewCellAccessoryType)tableView:(UITableView *)table accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath; UITableViewCellAccessoryDisclosureIndicator UITableViewCellAccessoryDetailDisclosureButton UITableViewCellAccessoryCheckmark - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { // Only for the blue disclosure button NSUInteger row = indexPath.row; ... }
  • 29. перезагрузить - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.tableView reloadData]; }
  • 30. добавление по ходу - (void)insertSections:(NSIndexSet *)sections withRowAnimation: (UITableViewRowAnimation)animation; - (void)deleteSections:(NSIndexSet *)sections withRowAnimation: (UITableViewRowAnimation)animation; - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation; - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;
  • 31. UITableViewDelegate • поведение + внешний вид • логика отдельно от данных!
  • 32. UITableViewDelegate - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath;
  • 33. обычно... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = indexPath.row id objectToDisplay = [myObjects objectAtIndex:row]; MyViewController *myViewController = ...; myViewController.object = objectToDisplay; [self.navigationController pushViewController:myViewController animated:YES]; }
  • 35. Хранение данных Property Lists • Property Lists - для небольшого объема • Writing an Array to Disk хранит обычные форматы данных iOS NSArray *array = [NSArray arrayWithObjects:@“Foo”, [NSNumber numberWithBool:YES], [NSDate dateWithTimeIntervalSinceNow:60], nil]; [array writeToFile:@“MyArray.plist” atomically:YES]; <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array> ! <string>Foo</string> ! <true/> ! <date>2010-02-02T09:26:18Z</date> </array> </plist>

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n