Upgrade to Pro — share decks privately, control downloads, hide ads and more …

UITableVIewの中身を分割してみませんか?

tokorom
February 13, 2014

 UITableVIewの中身を分割してみませんか?

UITableViewの中身をUIViewControllerで分割する方法と、DataSource/Delegateだけを分割する方法のメリット/デメリット

tokorom

February 13, 2014
Tweet

More Decks by tokorom

Other Decks in Technology

Transcript

  1. UITableViewͷத਎Λ ෼ׂͯ͠Έ·ͤΜ͔ʁ ॴ ༑ଠ @tokorom iOS App Programer These are

    “not” confidential sessions—please diffuse by your blogging and twitter potatotips #4
  2. ౖᔶͷSwitchจ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row

    = indexPath.row; NSUInteger section = indexPath.section; switch (section) { case MMSectionXXX: { MMXXXCell *cell = (MMXXXCell *)[self.tableView dequeueReusableCellWithIdentifier:@"MMXXXCell"]; if (nil == cell) { cell = [[MMXXXCell alloc] initWithReuseIdentifier:@"MMXXXCell"]; } cell.xxx = yyy; ɹɹɹɹɹ } break; case MMSectionYYY: case MMSectionZZZ:
  3. ϝΠϯͷViewController - (void)viewDidLoad { [super viewDidLoad]; ! [self addController:[PickupController new]];

    [self addController:[ListController new]]; [self addController:[ListController new]]; }
  4. ֤ηΫγϣϯͷController - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell

    = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier]; cell.textLabel.text = [NSString stringWithFormat:@"list %d", indexPath.row]; cell.imageView.image = [UIImage imageNamed:@"Dog"]; return cell; }
  5. More Information Yuta ToKoRo! iOS App Programer! @tokorom! ! http://www.tokoro.me/

    https://github.com/tokorom/TKRContainerTableViewController