123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- //
- // AccountAndSecurityViewController.m
- // ChinaTheoryNetwork
- //
- // Created by 张毅成 on 2019/1/28.
- // Copyright © 2019 张毅成. All rights reserved.
- //
- #import "AccountAndSecurityViewController.h"
- #import "AccountAndSecurityModel.h"
- #import "AccountAndSecurityTableViewCell.h"
- #import "ReplacePhoneNumberViewController.h"
- @interface AccountAndSecurityViewController ()<UITableViewDataSource, UITableViewDelegate>
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- /**
-
- */
- @property (strong, nonatomic) AccountAndSecurityModel *model;
- @end
- @implementation AccountAndSecurityViewController
- - (AccountAndSecurityModel *)model {
- if (!_model) {
- _model = [AccountAndSecurityModel new];
- }
- return _model;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"账号与安全";
- self.view.backgroundColor = kBackgroundColor;
- [self createTableView];
- }
- - (void)createTableView {
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.tableFooterView = [UIView new];
- self.tableView.rowHeight = UITableViewAutomaticDimension;
- self.tableView.estimatedRowHeight = 60;
- // self.tableView.separatorStyle = 0;
- self.tableView.backgroundColor = kBackgroundColor;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- UIView *view = [UIView new];
- [view setBackgroundColor:kBackgroundColor];
- return view;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
- UIView *view = [UIView new];
- [view setBackgroundColor:kBackgroundColor];
- return view;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 10;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
- return 10;
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return AccountAndSecurityModel.arrayData.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- AccountAndSecurityTableViewCell *cell = [AccountAndSecurityTableViewCell cellWithTableView:tableView];
- cell.labelTItle.text = AccountAndSecurityModel.arrayData[indexPath.row];
- if (indexPath.row == 0) {
- cell.labelDetail.text = self.modelMy.nickname;
- }else
- cell.labelDetail.text = self.modelMy.mobile;
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- ReplacePhoneNumberViewController *controller = [ReplacePhoneNumberViewController new];
- controller.modelMy = self.modelMy;
- [self.navigationController pushViewController:controller animated:true];
- }
- - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
- if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
- [cell setSeparatorInset:UIEdgeInsetsZero];
- }
- if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
- [cell setLayoutMargins:UIEdgeInsetsZero];
- }
- if([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
- [cell setPreservesSuperviewLayoutMargins:NO];
- }
- }
- @end
|