Skip to content

Commit

Permalink
you can remove map path
Browse files Browse the repository at this point in the history
  • Loading branch information
coderyi committed Sep 25, 2016
1 parent 116fed0 commit 5cc82ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
14 changes: 7 additions & 7 deletions NetworkEye/NetworkEye/NEHTTPEyeDetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ - (void)viewDidLoad {
[backBt addTarget:self action:@selector(backBtAction) forControlEvents:UIControlEventTouchUpInside];
[bar addSubview:backBt];

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

UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(([[UIScreen mainScreen] bounds].size.width-230)/2, 20, 230, 44)];
titleText.backgroundColor = [UIColor clearColor];
Expand Down
26 changes: 18 additions & 8 deletions NetworkEye/NetworkEye/NEMapViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ - (void)viewDidLoad {
[backBt addTarget:self action:@selector(backBtAction) forControlEvents:UIControlEventTouchUpInside];
[bar addSubview:backBt];

UIButton *deleteBt=[UIButton buttonWithType:UIButtonTypeCustom];
deleteBt.frame=CGRectMake([[UIScreen mainScreen] bounds].size.width-60, 27, 50, 30);
[deleteBt setTitle:@"delete" forState:UIControlStateNormal];
deleteBt.titleLabel.font=[UIFont systemFontOfSize:13];
[deleteBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[deleteBt addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside];
if (_model.mapJSONData.length>0) {
[bar addSubview:deleteBt];
}


UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(([[UIScreen mainScreen] bounds].size.width-230)/2, 20, 230, 44)];
titleText.backgroundColor = [UIColor clearColor];
titleText.textColor=[UIColor whiteColor];
Expand All @@ -54,25 +65,20 @@ - (void)viewDidLoad {
}else {
requestPath = [_model.requestURLString substringToIndex:requestPathRange.location];
}
_model.mapPath = requestPath ;
titleText.text=requestPath;
titleText.lineBreakMode = NSLineBreakByTruncatingHead;

mainTextView=[[UITextView alloc] initWithFrame:CGRectMake(0, 64, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64)];
[self.view addSubview:mainTextView];
mainTextView.text=_model.mapJSONData;

}

- (void)backBtAction {
if (![[mainTextView.text stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:_model.mapJSONData]) {
NSRange requestPathRange = [_model.requestURLString rangeOfString:@"?"];
NSString *requestPath;
if (requestPathRange.location == NSNotFound) {
requestPath =_model.requestURLString;
}else {
requestPath = [_model.requestURLString substringToIndex:requestPathRange.location];
}
_model.mapPath = requestPath ;

_model.mapJSONData = [mainTextView.text stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[[NEHTTPModelManager defaultManager] addMapObject:_model];
Expand All @@ -82,5 +88,9 @@ - (void)backBtAction {

}

- (void)rightAction {
[[NEHTTPModelManager defaultManager] removeMapObject:_model];
}


@end

0 comments on commit 5cc82ad

Please sign in to comment.