// // DetailOneImageViewController.m // model // // Created by MUMEI on 2018/8/7. // Copyright © 2018年 Mine. All rights reserved. // #import "DetailOneImageViewController.h" #import "DetailOneImageCell.h" #import "DetailFourImageCell.h" #import "PingLunCell.h" @interface DetailOneImageViewController () @property (weak, nonatomic) IBOutlet UITableView *tableView; @end @implementation DetailOneImageViewController - (void)viewDidLoad { [super viewDidLoad]; self.tableView.estimatedRowHeight = 20; self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; [self.tableView setSeparatorInset:UIEdgeInsetsZero]; // self.navigationItem.title = @"详情"; self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexString:@"#333333"] ; UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(0, 0, 40, 40); [btn setImage:[UIImage imageNamed:@"fanhui1"] forState:UIControlStateNormal]; btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0); [btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn]; UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整 self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem]; self.view.backgroundColor = [UIColor blackColor]; // Do any additional setup after loading the view from its nib. } -(void)backClick{ [self.navigationController popViewControllerAnimated:YES]; } #pragma mark - deleDate - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ if (section==0) { return 1; }else{ return 10; } } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section==0) { DetailFourImageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DetailFourImageCell"]; if(!cell){ cell = [[[UINib nibWithNibName:@"DetailFourImageCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject]; } return cell; }else{ PingLunCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PingLunCell"]; if(!cell){ cell = [[[UINib nibWithNibName:@"PingLunCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject]; } return cell; } return nil; } -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if(section==1){ return 10; } return 0.00000001; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end