<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to catch AGSMapView touch gestures? in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244446#M2313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Create a new MapView and inherit from AGSMapView. Now you can Overwrite all 4 touch Functions, but do not forget to call them on super-instance. After you have created the class, change the class of your mapView in InterfaceBuilder / XCode from AGSMapView to your new created class. (see attachement)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

//Header file
@interface TouchableMapView : AGSMapView {

 ...
}

//Mainfile

@implementation TouchableMapView

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
 [super touchesBegan:touches withEvent:event];
 ......
}

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
 
 [super touchesMoved:touches withEvent:event];
 .......
}

-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
 [super touchesEnded:touches withEvent:event];
 
 ......
 
 
}

-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
 [super touchesCancelled:touches withEvent:event];

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ........

}

@end

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you only want to track endpanning and endzooming you can attach your observer-object like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case "self" is an UIViewController which has function mapViewDidEndPanning:(NSNotification *) notification.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

//Is called when map did end panning
[[NSNotificationCenter defaultCenter] addObserver:self&amp;nbsp; selector:@selector(mapViewDidEndPanning:)&amp;nbsp; name:@"MapDidEndPanning" object:nil];


//is called when map did end zooming
 [[NSNotificationCenter defaultCenter] addObserver:self&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selector:@selector(mapViewDidEndPanning:) name:@"MapDidEndZooming" object:nil];

&lt;/PRE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;handler function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

-(void) mapViewDidEndPanning:(NSNotification *) notification
{
 //Check name of notification:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if([[notification name] isEqualToString:@"MapDidEndZooming"])
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ... 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

}


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:12:21 GMT</pubDate>
    <dc:creator>BedaKuster</dc:creator>
    <dc:date>2021-12-11T12:12:21Z</dc:date>
    <item>
      <title>How to catch AGSMapView touch gestures?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244445#M2312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi,all!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I need to fire some event everytime mapview pans or zooms.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; In the ViewController,I tried realise (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;&amp;nbsp; Other views in the ViewController can response to it. Only mapview can't.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I tried [mapView addGestureRecognizer:...],mapview still do not response to it,or even crash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Is there any method to realise it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you!~&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2011 01:23:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244445#M2312</guid>
      <dc:creator>lynnwang</dc:creator>
      <dc:date>2011-08-26T01:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to catch AGSMapView touch gestures?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244446#M2313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Create a new MapView and inherit from AGSMapView. Now you can Overwrite all 4 touch Functions, but do not forget to call them on super-instance. After you have created the class, change the class of your mapView in InterfaceBuilder / XCode from AGSMapView to your new created class. (see attachement)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

//Header file
@interface TouchableMapView : AGSMapView {

 ...
}

//Mainfile

@implementation TouchableMapView

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
 [super touchesBegan:touches withEvent:event];
 ......
}

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
 
 [super touchesMoved:touches withEvent:event];
 .......
}

-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
 [super touchesEnded:touches withEvent:event];
 
 ......
 
 
}

-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
 [super touchesCancelled:touches withEvent:event];

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ........

}

@end

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you only want to track endpanning and endzooming you can attach your observer-object like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case "self" is an UIViewController which has function mapViewDidEndPanning:(NSNotification *) notification.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

//Is called when map did end panning
[[NSNotificationCenter defaultCenter] addObserver:self&amp;nbsp; selector:@selector(mapViewDidEndPanning:)&amp;nbsp; name:@"MapDidEndPanning" object:nil];


//is called when map did end zooming
 [[NSNotificationCenter defaultCenter] addObserver:self&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selector:@selector(mapViewDidEndPanning:) name:@"MapDidEndZooming" object:nil];

&lt;/PRE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;handler function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

-(void) mapViewDidEndPanning:(NSNotification *) notification
{
 //Check name of notification:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if([[notification name] isEqualToString:@"MapDidEndZooming"])
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ... 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

}


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:12:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244446#M2313</guid>
      <dc:creator>BedaKuster</dc:creator>
      <dc:date>2021-12-11T12:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to catch AGSMapView touch gestures?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244447#M2314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thank you very much,it really works!`&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 01:37:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244447#M2314</guid>
      <dc:creator>lynnwang</dc:creator>
      <dc:date>2011-08-30T01:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to catch AGSMapView touch gestures?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244448#M2315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;but, after end touch and before end zooming,how to catch event in the animation time ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 05:51:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244448#M2315</guid>
      <dc:creator>lynnwang</dc:creator>
      <dc:date>2011-08-30T05:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to catch AGSMapView touch gestures?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244449#M2316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;and,,,if I want to catch AGSSketchGraphicsLayer click-at-a-point event,is that available?:confused:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 14:05:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-catch-agsmapview-touch-gestures/m-p/244449#M2316</guid>
      <dc:creator>lynnwang</dc:creator>
      <dc:date>2011-08-30T14:05:23Z</dc:date>
    </item>
  </channel>
</rss>

