Skip to content

Commit 5cc82ad

Browse files
committed
you can remove map path
1 parent 116fed0 commit 5cc82ad

2 files changed

Lines changed: 25 additions & 15 deletions

File tree

NetworkEye/NetworkEye/NEHTTPEyeDetailViewController.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ - (void)viewDidLoad {
4242
[backBt addTarget:self action:@selector(backBtAction) forControlEvents:UIControlEventTouchUpInside];
4343
[bar addSubview:backBt];
4444

45-
UIButton *settingsBt=[UIButton buttonWithType:UIButtonTypeCustom];
46-
settingsBt.frame=CGRectMake([[UIScreen mainScreen] bounds].size.width-60, 27, 50, 30);
47-
[settingsBt setTitle:@"map" forState:UIControlStateNormal];
48-
settingsBt.titleLabel.font=[UIFont systemFontOfSize:13];
49-
[settingsBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
50-
[settingsBt addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside];
51-
[bar addSubview:settingsBt];
45+
UIButton *mapBt=[UIButton buttonWithType:UIButtonTypeCustom];
46+
mapBt.frame=CGRectMake([[UIScreen mainScreen] bounds].size.width-60, 27, 50, 30);
47+
[mapBt setTitle:@"map" forState:UIControlStateNormal];
48+
mapBt.titleLabel.font=[UIFont systemFontOfSize:13];
49+
[mapBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
50+
[mapBt addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside];
51+
[bar addSubview:mapBt];
5252

5353
UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(([[UIScreen mainScreen] bounds].size.width-230)/2, 20, 230, 44)];
5454
titleText.backgroundColor = [UIColor clearColor];

NetworkEye/NetworkEye/NEMapViewController.m

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ - (void)viewDidLoad {
4141
[backBt addTarget:self action:@selector(backBtAction) forControlEvents:UIControlEventTouchUpInside];
4242
[bar addSubview:backBt];
4343

44+
UIButton *deleteBt=[UIButton buttonWithType:UIButtonTypeCustom];
45+
deleteBt.frame=CGRectMake([[UIScreen mainScreen] bounds].size.width-60, 27, 50, 30);
46+
[deleteBt setTitle:@"delete" forState:UIControlStateNormal];
47+
deleteBt.titleLabel.font=[UIFont systemFontOfSize:13];
48+
[deleteBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
49+
[deleteBt addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside];
50+
if (_model.mapJSONData.length>0) {
51+
[bar addSubview:deleteBt];
52+
}
53+
54+
4455
UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(([[UIScreen mainScreen] bounds].size.width-230)/2, 20, 230, 44)];
4556
titleText.backgroundColor = [UIColor clearColor];
4657
titleText.textColor=[UIColor whiteColor];
@@ -54,25 +65,20 @@ - (void)viewDidLoad {
5465
}else {
5566
requestPath = [_model.requestURLString substringToIndex:requestPathRange.location];
5667
}
68+
_model.mapPath = requestPath ;
5769
titleText.text=requestPath;
5870
titleText.lineBreakMode = NSLineBreakByTruncatingHead;
5971

6072
mainTextView=[[UITextView alloc] initWithFrame:CGRectMake(0, 64, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64)];
6173
[self.view addSubview:mainTextView];
6274
mainTextView.text=_model.mapJSONData;
75+
6376
}
6477

6578
- (void)backBtAction {
6679
if (![[mainTextView.text stringByTrimmingCharactersInSet:
6780
[NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:_model.mapJSONData]) {
68-
NSRange requestPathRange = [_model.requestURLString rangeOfString:@"?"];
69-
NSString *requestPath;
70-
if (requestPathRange.location == NSNotFound) {
71-
requestPath =_model.requestURLString;
72-
}else {
73-
requestPath = [_model.requestURLString substringToIndex:requestPathRange.location];
74-
}
75-
_model.mapPath = requestPath ;
81+
7682
_model.mapJSONData = [mainTextView.text stringByTrimmingCharactersInSet:
7783
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
7884
[[NEHTTPModelManager defaultManager] addMapObject:_model];
@@ -82,5 +88,9 @@ - (void)backBtAction {
8288

8389
}
8490

91+
- (void)rightAction {
92+
[[NEHTTPModelManager defaultManager] removeMapObject:_model];
93+
}
94+
8595

8696
@end

0 commit comments

Comments
 (0)