//
// KINGTableViewController.m
// TableViewLoadTwoXib
//
// Created by on 15/10/29.
// Copyright © 2015年 MR.KING. All rights reserved.
//
#import "KINGTableViewController.h"
@interface KINGTableViewController ()
@end
@implementation KINGTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
if (indexPath.row%2 == 0) {
cell = [tableView dequeueReusableCellWithIdentifier:@"red" ];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:@"KINGTableViewCell" owner:nil options:nil][1];
}
}else{
cell =[tableView dequeueReusableCellWithIdentifier: @"blue"];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:@"KINGTableViewCell" owner:nil options:nil][0];
}
}
return cell;
}
// KINGTableViewController.m
// TableViewLoadTwoXib
//
// Created by on 15/10/29.
// Copyright © 2015年 MR.KING. All rights reserved.
//
#import "KINGTableViewController.h"
@interface KINGTableViewController ()
@end
@implementation KINGTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
if (indexPath.row%2 == 0) {
cell = [tableView dequeueReusableCellWithIdentifier:@"red" ];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:@"KINGTableViewCell" owner:nil options:nil][1];
}
}else{
cell =[tableView dequeueReusableCellWithIdentifier: @"blue"];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:@"KINGTableViewCell" owner:nil options:nil][0];
}
}
return cell;
}