Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ViewController.m
- // Lab4
- //
- // Created by Анна Родионова on 12/12/2018.
- // Copyright © 2018 Veirisa. All rights reserved.
- //
- #import "ListModel.h"
- #import "ModelManager.h"
- #import "ViewController.h"
- @interface ViewController ()
- @property (weak, nonatomic) IBOutlet UITableView *listTableView;
- @property (strong, nonatomic) NSArray* model;
- @end
- @implementation ViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.model = [ModelManager getModel];
- //[self.listTableView setSectionIndexBackgroundColor: [UIColor blueColor]];
- //[self.listTableView reloadData];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return [self.model count];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return [(NSArray*)self.model[section] count] + 1;
- }
- - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
- return ((ListModel*)self.model[section]).name;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ListCell"];
- ListModel* listModel = (ListModel*)self.model[indexPath.section];
- if (indexPath.row == [listModel.tasksList count]) {
- [cell.backgroundView setBackgroundColor:[UIColor blueColor]];
- } else {
- [cell.textLabel setText: listModel.tasksList[indexPath.row]];
- }
- return cell;
- }
- //return [NSString stringWithFormat:@"%@%ld", @"dog", section];
- //return [tableView dequeueReusableCellWithIdentifier:@"ListCell"];
- /*
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- //return [tableView dequeueReusableCellWithIdentifier:@"ListCell"];
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ListCell"];
- [cell.textLabel setText: [NSString stringWithFormat:@"%@%ld", @"cat", indexPath.row]];
- //[cell.textLabel setFont:[UIFont systemFontOfSize:10]];
- return cell;
- GPFinancePaymentsCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([GPFinancePaymentsCell class]) forIndexPath:indexPath];
- if (cell == nil) {
- cell = [[GPFinancePaymentsCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:NSStringFromClass([GPFinancePaymentsCell class])];
- }
- [cell initWithInformation:self.agreements[indexPath.row - 1]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- */
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement