diff --git a/NetworkEye/NetworkEye/NEHTTPEyeDetailViewController.m b/NetworkEye/NetworkEye/NEHTTPEyeDetailViewController.m index df52b84..6db5634 100644 --- a/NetworkEye/NetworkEye/NEHTTPEyeDetailViewController.m +++ b/NetworkEye/NetworkEye/NEHTTPEyeDetailViewController.m @@ -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]; diff --git a/NetworkEye/NetworkEye/NEMapViewController.m b/NetworkEye/NetworkEye/NEMapViewController.m index 4165211..24d9685 100644 --- a/NetworkEye/NetworkEye/NEMapViewController.m +++ b/NetworkEye/NetworkEye/NEMapViewController.m @@ -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]; @@ -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]; @@ -82,5 +88,9 @@ - (void)backBtAction { } +- (void)rightAction { + [[NEHTTPModelManager defaultManager] removeMapObject:_model]; +} + @end