相关疑难解决方法(0)

有没有办法限制MKMapView的最大缩放级别?

问题是 - 有没有办法限制MKMapView的最大缩放级别?或者有没有办法跟踪用户何时缩放到没有可用地图图像的级别?

iphone zoom mkmapview

34
推荐指数
6
解决办法
3万
查看次数

iPhone:在MKMapView中检测Tap

如何在实例上检测到单击MKMapView?我是否必须继承MKMapView并重写该touchesEnded方法?

谢谢,

-克里斯

cocoa-touch mapkit mkmapview ios

22
推荐指数
2
解决办法
2万
查看次数

在UITableView中观察捏合多点触摸手势

我想在UITableView上实现一个捏合/外出,我已经看了几个方法,包括这个:

类似的问题

但是虽然我可以创建一个UIViewTouch对象并将其覆盖到我的UITableView上,滚动事件不会被转发到我的UITableView,我仍然可以选择单元格,并且它们通过触发转换到新的ViewController对象来正确响应.但是,尽管传递了touchesBegan,touchesMoved和touchesEnded事件,但我无法滚动UITableView.

iphone multi-touch uitableview pinch

19
推荐指数
2
解决办法
1万
查看次数

UIView,如何确定何时触摸进入视图

似乎只有触摸在该视图的边界内开始时才会调用UIView的所有触摸方法.有没有办法让视图响应在视图外触摸但随后将手指拖入视图的用户?

如果重要,我的具体应用是拖动MKPinAnnotationView(使用内置的4.0拖动).如果用户将一个引脚拖动到另一个视图(这恰好是一个AnnotationView,但它可能是任何东西),我想要发生一些事情.在我放开引脚之前,没有调用拖动的方法; 并且没有方法没有被拖动的UIView似乎被调用,除非我从视图中触摸开始.

因为superview是MKMapView,所以很难只使用touchesMoved事件并检查用户是否在正确的位置.谢谢!

iphone objective-c mkmapview touches

11
推荐指数
1
解决办法
1594
查看次数

在地图上重叠注释(MKAnnotationView)的问题

在我的iphone应用程序中,我使用MapKit和MKMapView以及自定义MKAnnotationView.

问题是当注释在地图上重叠时(在我的应用中,注释是照片而这些照片可能重叠),当你点击前面出现的注释时,它是另一个注释(在背面)接收事件(似乎是随机的) ).

我没有找到任何方法将事件发送到前端注释.我不敢相信这个bug /问题没有任何解决方案!

stackoverflow上的Z排序重叠注释问题的顺序对我没有多大帮助.

欢迎任何想法(即使是肮脏的解决方案)!

这是我的一些代码(没什么特别的,很常见):

CustomAnnotation.h

@interface CustomAnnotation : NSObject <MKAnnotation> {
   @private
   CustomAnnotationView* view;
}

    @property (nonatomic, retain) CustomAnnotationView* view;

@end
Run Code Online (Sandbox Code Playgroud)

CustomAnnotation.m

@implementation CustomAnnotation

@synthetize view;
Run Code Online (Sandbox Code Playgroud)

CustomAnnotationView.h

@interface CustomAnnotationView : MKAnnotationView {
}

@end
Run Code Online (Sandbox Code Playgroud)

CustomAnnotationView.m

@implementation CustomAnnotationView

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
// Do something related to the annotation tapped
}

@end
Run Code Online (Sandbox Code Playgroud)

主类... //添加了注释,其中一些与其他注释重叠.

- (void)addAnnotation:(CustomAnnotation*)annotation {
    [map addAnnotation:annotation];
}

...

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {

    NSString* identifier …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c mapkit mkmapview mkannotation

9
推荐指数
1
解决办法
4560
查看次数

在MKMapView的叠加层上触摸事件

在我正在设计的应用程序中,我有一个MKMapView覆盖它(自定义MKPolylinesbtw),我希望能够检测这些覆盖上的触摸事件,并为每个覆盖分配特定的操作.有人可以帮我这个吗?谢谢 !

贝尼亚

overlay mkmapview touch-event mkpolyline

9
推荐指数
2
解决办法
5676
查看次数

有没有更好的方法从iOS应用程序"喜欢"Facebook页面呢?

我一直在尝试在我的应用程序中实现Facebook"喜欢"操作.使用requestWithGraphPath:andParams:andHttpMethod:andDelegate:方法我能够喜欢帖子,照片以及除Facebook页面之外的所有内容.网络上的论坛表示,这是出于某些安全原因,以防止某些垃圾邮件应用强行让用户"喜欢"他们的网页.这完全有道理.因此,这提出了一个问题,即在没有他们知识的情况下让用户"喜欢"帖子或照片并不违法?而且,是的,这完全超出了这个问题的范围;-)

说到这一点,我用谷歌搜索了什么是最有利的解决方案,大多数论坛/帖子都建议在UIWebView中添加"Like"按钮iFrame是现在更好/唯一的方式.所以我只想与你们仔细检查一下,从iOS应用程序中更好地了解Facebook页面,而不必使用最近的UIWebView,或者我只需要使用它

我真的很感激大家!

iphone objective-c fbconnect ios

8
推荐指数
1
解决办法
5550
查看次数

拦截/劫持MKMapView的iPhone Touch事件

3.0 SDK中是否存在禁用实时缩放和拦截MKMapView放大手势的错误?我有一些真正简单的代码,所以我可以检测到tap事件,但有两个问题:

  1. 放大手势始终被解释为缩小
  2. 没有一个缩放手势实时更新Map的视图.

在hitTest中,如果我返回"map"视图,MKMapView功能效果很好,但我没有机会拦截事件.

有任何想法吗?

MyMapView.h:

@interface MyMapView : MKMapView
{
    UIView      *map;
}
Run Code Online (Sandbox Code Playgroud)

MyMapView.m:

- (id)initWithFrame:(CGRect)frame
{
    if (![super initWithFrame:frame])
        return nil;

    self.multipleTouchEnabled = true;

    return self;
}

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    NSLog(@"Hit Test");
    map = [super hitTest:point withEvent:event];
    return self;
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"%s", __FUNCTION__);
    [map touchesCancelled:touches withEvent:event];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event
{
    NSLog(@"%s", __FUNCTION__);
    [map touchesBegan:touches withEvent:event];
}

- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
    NSLog(@"%s, %x", __FUNCTION__, mViewTouched);
    [map touchesMoved:touches withEvent:event]; …
Run Code Online (Sandbox Code Playgroud)

iphone events gesture-recognition

6
推荐指数
3
解决办法
2万
查看次数

在iOS 5中检测用户对MKMapView的触摸

我有一个MKMapViewViewController,并希望在他/她用这些方法触摸地图时检测用户的手势:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
Run Code Online (Sandbox Code Playgroud)

该应用程序适用于iOS 3,iOS 4,但当我在iOS 5上运行iPhone调试应用程序时,我看到此消息:

Pre-iOS 5.0 touch delivery method forwarding relied upon. Forwarding -touchesCancelled:withEvent: to <MKAnnotationContainerView: 0x634790; frame = (0 0; 262144 262144); autoresizesSubviews = NO; layer = <CALayer: 0x634710>>
Run Code Online (Sandbox Code Playgroud)

并且未达到上述4种方法中的代码.

你知道怎么解决吗?

谢谢.

iphone objective-c mkmapview touch-event ios

6
推荐指数
1
解决办法
3328
查看次数

检测 MKPolyline 上的触摸手势

在我的应用程序中,我有一个带有几个 MKGeodesicPolylines 的 MapView。我希望能够识别这些线上的触摸手势。使用以下方法添加叠加层:

[_mapView addOverlay:polyline];

- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id < MKOverlay >)overlay
{
    if ([overlay class] == [MKGeodesicPolyline class])
    {
        MKPolylineRenderer *renderer = [[[MKPolylineRenderer alloc] initWithPolyline:overlay] autorelease];
        renderer.lineWidth = 4.0;
        renderer.strokeColor = [UIColor blackColor];
        return renderer;
    }
 return nil;
}
Run Code Online (Sandbox Code Playgroud)

我试过WildcardGestureRecognizer应该符合我的目的。这是我正在使用的代码:

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {

        .... MapView init ....

        WildcardGestureRecognizer * tapInterceptor = [[WildcardGestureRecognizer alloc] init];
        tapInterceptor.touchesBeganCallback = ^(NSSet * touches, UIEvent * event) {
            UITouch *touch = [touches anyObject]; …
Run Code Online (Sandbox Code Playgroud)

uigesturerecognizer ios mkpolyline

5
推荐指数
1
解决办法
2238
查看次数

UIMapView:未调用UIPinchGestureRecognizer

UIMapView按照这个问题的接受答案中描述的方式实现了手势识别:如何拦截触摸MKMapView或UIWebView对象上的事件?

可以正确识别单个触摸.然而,当我改变了我的类的超从UIGestureRecognizerUIPinchGestureRecognizer以识别地图缩放,一切都停止了工作.现在只有当用户双击地图上的注释时才会发生TouchesEnded事件(不知道,为什么!)并且当用户捏住地图时不会发生(放大或缩小无关紧要).

PS我正在使用iOS SDK 4.3并在模拟器中测试我的应用程序,如果这很重要.

mapViewController.m的代码 - viewDidLoad方法:

 - (void)viewDidLoad
 {
     [super viewDidLoad];
     MapGestureRecognizer *changeMapPositionRecognizer = [[MapGestureRecognizer alloc] init];
     changeMapPositionRecognizer.touchesEndedCallback = ^(NSSet * touches, UIEvent * event) 
     {
        ...
     };
     [self.mapView addGestureRecognizer:changeMapPositionRecognizer];
     [changeMapPositionRecognizer release];
}
Run Code Online (Sandbox Code Playgroud)

MapGestureRecognizer.h的代码:

#import <UIKit/UIKit.h>
typedef void (^TouchesEventBlock) (NSSet * touches, UIEvent * event);
@interface MapGestureRecognizer : UIPinchGestureRecognizer    
@property(nonatomic, copy) TouchesEventBlock touchesEndedCallback;
@end
Run Code Online (Sandbox Code Playgroud)

MapGestureRecognizer.m的代码:

#import "MapGestureRecognizer.h"

@implementation MapGestureRecognizer
@synthesize touchesEndedCallback = _touchesEndedCallback;

- (id)init
{
    self = [super …
Run Code Online (Sandbox Code Playgroud)

iphone mkmapview uigesturerecognizer ios4

2
推荐指数
1
解决办法
1606
查看次数

MKPinAnnotationView 上的双选触摸

编辑:将标题从“双击..”更改为“双击选择触摸..”

我需要在我的应用程序中检测至少对 MKPinAnnotationView 的第二次触摸。目前我能够获得第一次触摸(我从这里使用 kvo:Detecting when MKAnnotation is selected in MKMapView),并且它在第一次触摸时效果很好),但是如果我再次点击引脚,则不会调用任何内容,因为所选值不会改变。我尝试使用自 ios 4 以来有效的“mapView:didSelectAnnotationView:”进行相同的操作,但在第二次点击时也不会再次调用它。

如果有人能帮助我解决这个问题,那就太好了!

此致

编辑,添加更多信息:

因此,触摸不必很快,如果用户触摸图钉,我会在注释的标题和副标题中显示一条消息,如果用户再次触摸同一个图钉,所以我会用它做另一件事

iphone mkpinannotationview mkannotation mkannotationview ios

0
推荐指数
1
解决办法
2004
查看次数