@@ -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