-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0) {
return 1;
}else if (section == 1){
return 4;
}else if (section == 2){
return 1;
}
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = nil;
if (indexPath.section == 0) {
cell = [self createSection1:indexPath];
}else if (indexPath.section == 1){
cell = [self createSection2:indexPath];
}else if (indexPath.section == 2){
cell = [self createSection3:indexPath];
}
return cell;
}
- (UITableViewCell*)createSection1:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"ImageCell";
UITableViewCell *cell = (ImageCell *)[ContentTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (indexPath.row == 0) {
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"ImageCell" owner:self options:nil];
for (id obj in nib) {
if ([obj isKindOfClass:[ImageCell class]]) {
cell = (ImageCell *)obj;
}
}
}
if (self.index == 1) {
[((ImageCell *)cell).TopImageView setImageWithURL:(NSURL *)touristImage];
}
}
return cell;
}
- (UITableViewCell*)createSection2:(NSIndexPath *)indexPath
{
UITableViewCell *cell = nil;
static NSString *cellIdentifier = @"Cell";
if (indexPath.row == 0) {
cell = (FactsCell *)[ContentTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"FactsCell" owner:self options:nil];
for (id obj in nib) {
if ([obj isKindOfClass:[FactsCell class]]) {
cell = (FactsCell *)obj;
}
}
}
}else if (indexPath.row == 1){
cell = (MutiDetailCell *)[ContentTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"MutiDetailCell" owner:self options:nil];
for (id obj in nib) {
if ([obj isKindOfClass:[MutiDetailCell class]]) {
cell = (MutiDetailCell *)obj;
}
}
}
}else {
cell = (PlusCell *)[ContentTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"PlusCell" owner:self options:nil];
for (id obj in nib) {
if ([obj isKindOfClass:[PlusCell class]]) {
cell = (PlusCell *)obj;
}
}
}
}
if (indexPath.row == 0) {
((FactsCell *)cell).playLabel.text = @"2小时";
((FactsCell *)cell).opentimeLabel.text = @"上午 9:00 - 下午 5:00";
}
else if (indexPath.row == 1) {
((MutiDetailCell *)cell).thumbView.image = IMAGE_WITH_NAME2(@"Tickets");
((MutiDetailCell *)cell).priceLabel.text = @"50元";
}
else if (indexPath.row == 2) {
((PlusCell *)cell).thumbView.image = IMAGE_WITH_NAME2(@"LandMarks");
((PlusCell *)cell).textLabel.text = @"达州市通川区上华路92号";
}
else if (indexPath.row == 3) {
((PlusCell *)cell).thumbView.image = IMAGE_WITH_NAME2(@"PhoneBig");
((PlusCell *)cell).textLabel.text = @"028-88888888";
}
return cell;
}
- (UITableViewCell*)createSection3:(NSIndexPath *)indexPath
{
UITableViewCell *cell = nil;
static NSString *cellIdentifier = @"SingelCell";
cell = (SingelCell *)[ContentTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"SingelCell" owner:self options:nil];
for (id obj in nib) {
if ([obj isKindOfClass:[SingelCell class]]) {
cell = (SingelCell *)obj;
}
}
}
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
return 160;
}else if(indexPath.section == 1 && indexPath.row == 0){
return 87;
}else if(indexPath.section == 1 && indexPath.row == 1){
return 44;
}
else if (indexPath.section == 2){
return 100;
}
return 44;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 1;
}