嗨,如果用户触摸,我正在尝试实现Annotations分组和动画.
我确实看了一个不同的集群库解决方案,但这对我不起作用,因为我在同一个坐标中有多个注释.
所以这就是我想要做的
1-我在同一个地方(坐标)中识别出多个注释的位置?怎么能实现这个?在相同的坐标中找到注释并创建一个新的组注释?
2-更改该注释的颜色(让用户知道)我可以在这个方法上做到这一点
-(MKAnnotationView*)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation;
如果用户触摸该组中的注释,则注释将围绕其位置以圆圈移动.
到目前为止,我在地图上的所有注释都有一个非常黑暗的阴影.
我想现在专注于第一项任务 - 分组
我不是要求代码示例我可以做到这一点我只需要帮助找出用于实现任务的方法.

谢谢你的帮助.
在我的app委托中,如果保存了用户详细信息,我将用户推送到视图控制器
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
// cached user
PFUser *currentUser = [PFUser currentUser];
if (currentUser)
{
NSLog(@"current user signing and looking for VC %@", currentUser);
// A user was cached, so skip straight to the main view
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
TaskSelectionViewController*viewController = [[TaskSelectionViewController alloc] initWithUser:currentUser];
[navigationController pushViewController:viewController animated:YES];
NSLog(@"VC found");
} else {
NSLog(@"VC not found");
}
Run Code Online (Sandbox Code Playgroud)
TaskSelectionViewController.m
-(id)initWithUser:(PFUser *)currentUser
{
NSLog(@"current user %@", currentUser);
NSLog(@"task Selection initwithuser");
return self;
}
Run Code Online (Sandbox Code Playgroud)
推送工作正常,但我得到的是顶部的NavigationController栏和黑色屏幕.
缺什么 ??
谢谢你的帮助.
我在一个 - LayoutView 中绘制了 3 个正方形
- (void)drawRect:(CGRect)rect
self.room1 = [UIBezierPath bezierPathWithRect:CGRectMake(81, 10, 60, 60)];
[self.normalColor setFill];
[self.room1 fill];
[[UIColor blackColor]setStroke];
self.room1.lineWidth = 1;
[self.room1 stroke];
Run Code Online (Sandbox Code Playgroud)
然后我找到了正确的 UIBezierPath
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touch here");
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self];
if ([self.room1 containsPoint:touchPoint])
{
// do stuff
NSLog(@"room1 %@" , self.room1);
[[UIColor redColor] setFill];
[self.room1 fill];
[self setNeedsDisplay];
}
}
Run Code Online (Sandbox Code Playgroud)
这是工作我触摸房间 1 和日志打印“房间 1”
但是如何更改 room1 的颜色?
目前我收到一个错误
: CGContextSetFillColorWithColor: 无效的上下文 0x0。这是一个严重的错误。...
谢谢你的帮助。
我设法让Json为我的服务器并在Xcode中解析,然后我可以将Json转换为对象并加载我的uitableview,问题是我的Json有7个对象..
2012-05-05 10:45:02.727 passingdata[63856:fb03] array : {
posts = {
Friday = (
{
GymClass = {
"CLASS-TYPE2" = "";
"CLASS_LEVEL" = "Intro/General";
"CLASS_TYPE" = "Muay Thai";
"DAY_OF_WEEK" = Friday;
TIME = "13:00 - 14:30";
};
}
);
Monday = (
{
GymClass = {
"CLASS-TYPE2" = "Fighters Training";
"CLASS_LEVEL" = "Fighters/Advanced/Intermediate";
"CLASS_TYPE" = "Muay Thai ";
"DAY_OF_WEEK" = Monday;
TIME = "09:30 - 11:00";
};
}, ......
Run Code Online (Sandbox Code Playgroud)
使用此代码,我可以获得星期五的"星期五",并在我的桌子上显示GymClass信息"GymClass"
- (void)fetchedData:(NSData *)responseData { //parse out the …Run Code Online (Sandbox Code Playgroud) ios ×3
xcode ×2
annotations ×1
ios5 ×1
ios6 ×1
ios7 ×1
iphone ×1
json ×1
mapkit ×1
objective-c ×1
storyboard ×1
uibezierpath ×1
uitableview ×1