MKPinAnnotationView引脚的宽度和高度(以像素为单位)是多少?
编辑:更具体地说,iPhone屏幕上包含引脚的虚构矩形的宽度和高度.
这段代码
NSCalendar *calendar =[NSCalendar currentCalendar];
[gregorian setTimeZone:tz];
NSLog(@"%@", [gregorian timeZone]);
NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:[NSDate date]];
[comp setDay:info.day];
[comp setMonth:info.month];
[comp setYear:info.year];
[comp setHour:info.hour];
[comp setMinute:info.minute];
[comp setSecond:info.second];
[comp setTimeZone:tz];
NSLog(@"%@", [comp timeZone]);
NSLog(@"%@", [gregorian dateFromComponents:comp]);
Run Code Online (Sandbox Code Playgroud)
在控制台中显示以下内容:
Europe/Moscow (MSKS) offset 14400 (Daylight)
Europe/Moscow (MSKS) offset 14400 (Daylight)
2011-08-31 20:00:00 +0000
Run Code Online (Sandbox Code Playgroud)
因此,正确指定了日历和组件的时区,但[gregorian dateFromComponents:comp]返回带有错误时区(GMT)的NSDate值.
我需要纠正什么才能获得合适的时区?
我UIMapView按照这个问题的接受答案中描述的方式实现了手势识别器:如何拦截触摸MKMapView或UIWebView对象上的事件?
可以正确识别单个触摸.然而,当我改变了我的类的超从UIGestureRecognizer到UIPinchGestureRecognizer以识别地图缩放,一切都停止了工作.现在只有当用户双击地图上的注释时才会发生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)