DetailOneImageViewController.m 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // DetailOneImageViewController.m
  3. // model
  4. //
  5. // Created by MUMEI on 2018/8/7.
  6. // Copyright © 2018年 Mine. All rights reserved.
  7. //
  8. #import "DetailOneImageViewController.h"
  9. #import "DetailOneImageCell.h"
  10. #import "DetailFourImageCell.h"
  11. #import "PingLunCell.h"
  12. @interface DetailOneImageViewController ()
  13. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  14. @end
  15. @implementation DetailOneImageViewController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. self.tableView.estimatedRowHeight = 20;
  19. self.tableView.rowHeight = UITableViewAutomaticDimension;
  20. self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  21. [self.tableView setSeparatorInset:UIEdgeInsetsZero];
  22. // self.navigationItem.title = @"详情";
  23. self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexString:@"#333333"] ;
  24. UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
  25. btn.frame = CGRectMake(0, 0, 40, 40);
  26. [btn setImage:[UIImage imageNamed:@"fanhui1"] forState:UIControlStateNormal];
  27. btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
  28. [btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
  29. UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
  30. UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
  31. nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
  32. self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
  33. self.view.backgroundColor = [UIColor blackColor];
  34. // Do any additional setup after loading the view from its nib.
  35. }
  36. -(void)backClick{
  37. [self.navigationController popViewControllerAnimated:YES];
  38. }
  39. #pragma mark - deleDate
  40. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  41. {
  42. return 2;
  43. }
  44. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  45. if (section==0) {
  46. return 1;
  47. }else{
  48. return 10;
  49. }
  50. }
  51. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  52. if (indexPath.section==0) {
  53. DetailFourImageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DetailFourImageCell"];
  54. if(!cell){
  55. cell = [[[UINib nibWithNibName:@"DetailFourImageCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject];
  56. }
  57. return cell;
  58. }else{
  59. PingLunCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PingLunCell"];
  60. if(!cell){
  61. cell = [[[UINib nibWithNibName:@"PingLunCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject];
  62. }
  63. return cell;
  64. }
  65. return nil;
  66. }
  67. -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  68. if(section==1){
  69. return 10;
  70. }
  71. return 0.00000001;
  72. }
  73. - (void)didReceiveMemoryWarning {
  74. [super didReceiveMemoryWarning];
  75. // Dispose of any resources that can be recreated.
  76. }
  77. @end