IVTInformViewController.m
4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//
// IVTInformViewController.m
// IVTMeLiveTwo
//
// Created by xrg on 16/10/14.
// Copyright © 2016年 QLQ. All rights reserved.
//
#import "IVTInformViewController.h"
#import "Masonry.h"
#import "UIFont+IVTMeFont.h"
#import "UIColor+IVTMeColor.h"
#import "SVProgressHUD.h"
#import "AFNetworking.h"
#import "AFURLSessionManager.h"
@interface IVTInformViewController ()<UITableViewDataSource,UITableViewDelegate>
{
NSArray *juBaoContentArray;
NSInteger currentSelectedRow;
}
@property (nonatomic, strong) UITableView *informTabelView;
@property (nonatomic, retain) NSIndexPath *selectedIndexPath;
@end
@implementation IVTInformViewController
- (void)viewDidLoad {
[super viewDidLoad];
juBaoContentArray = [NSArray arrayWithObjects:@"色情低俗",@"政治敏感",@"谣言",@"欺诈骗钱",@"违法(暴力恐怖、违禁品等)",@"未成年",@"其他", nil];
currentSelectedRow = 0;
[self creatTableView];
// _stateDic = [[NSMutableDictionary alloc] initWithDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:@"state"]];
// NSInteger row = [[[NSUserDefaults standardUserDefaults] objectForKey:@"lastRow"] integerValue];
// self.selectedIndexPath = [NSIndexPath indexPathForRow:row inSection:0];
// Do any additional setup after loading the view.
}
- (void)creatTableView
{
_informTabelView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0,kScreenWidth ,kScreenHeight) style:UITableViewStyleGrouped];
_informTabelView.delegate = self;
_informTabelView.dataSource = self;
_informTabelView.backgroundColor = [UIColor IVTBackgroundColor];
[self.view addSubview:_informTabelView];
}
#pragma mark - tableview代理方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 7;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (indexPath.row == currentSelectedRow) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else{
cell.accessoryType = UITableViewCellAccessoryNone;
}
cell.textLabel.text = [juBaoContentArray objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (currentSelectedRow != indexPath.row) {
NSIndexPath *oldSelectedIndexPath = [NSIndexPath indexPathForRow:currentSelectedRow inSection:0];
currentSelectedRow = indexPath.row;
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:oldSelectedIndexPath,indexPath, nil] withRowAnimation:UITableViewRowAnimationFade];
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return @"请选择举报原因";
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 40;
}
- (void)sendInform:(id)sender
{
// dic = @{@"Membership_Id1":@(10016)}
UIImage *imagePicker = [UIImage imageNamed:@"返回键"];
NSData *imageData = UIImageJPEGRepresentation(imagePicker, 0.4);
// UIImage *image = [UIImage imageWithData:imageData];
NSDictionary *dict1 = @{@"userId":@([[IVTAccountTool getUserId] intValue]),@"liveId":@([self.liveId intValue]),@"reason":juBaoContentArray[currentSelectedRow]};
// [[IVTNetworkAPIClient sharedClient] sendReprot:imageData success:^(NSDictionary *successData) {
// LRLog(@"~");
// } error:^(ErrorCode errorCode) {
// LRLog(@"~");
// } failure:^(NSError *failureError) {
// LRLog(@"~");
// }];
[[IVTNetworkAPIClient sharedClient] sendReprot:imageData paramDict:dict1 success:^(NSDictionary *successData) {
LRLog(@"~");
} error:^(NSDictionary *successData) {
// LRLog(@"~");
} failure:^(NSError *failureError) {
LRLog(@"~");
}];
}
//取消按钮点击
-(void)backToTopPage:(id)sender{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end