我不知道我做错了什么,但它不会工作.
我mapView: viewForAnnotation:看起来像这样:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
MKAnnotationView *aView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"ImageMapView"];
if (!aView)
{
aView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"ImageMapView"];
aView.canShowCallout = YES;
aView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
aView.leftCalloutAccessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
}
[(UIImageView *)aView.leftCalloutAccessoryView setImage:nil];
aView.annotation = annotation;
return aView;
}
Run Code Online (Sandbox Code Playgroud)
所以每个新的注释都以左侧标注中的空白图像视图开始.
现在当触摸标注时,执行下一个代码:
- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view
{
//loading an image
[(UIImageView *)view.leftCalloutAccessoryView setImage:image];
}
Run Code Online (Sandbox Code Playgroud)
在日志记录的帮助下,我知道图像的网址和数据都没问题,图像本身也不是零,但左侧标注中没有显示任何内容.
任何人都可以建议我如何追查这个问题的根源?
我添加了一些日志,所以我可以看到发生了什么:
- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view
{
UIImage *image = …Run Code Online (Sandbox Code Playgroud) 根据另一个答案,如果你定义一个变量而没有def它变成"全局",那么你可以从脚本的任何地方访问它.我怎么能用方法做到这一点(因为没有defAFAIK 没有定义)?
为了记录:我正在定义Jenkins管道,并希望从各个阶段之外访问一些"全局"方法
我想重新定义smalltalk的nil,就像在objective-c中那样工作.因此,当nil收到无法处理的消息时,它返回nil.现在我知道这nil只是一个快捷方式,UndefinedObject但有没有像Ruby这样的东西method_missing,所以我可以重新定义它以便总是返回nil?UndefinedObject
我正在使用twitter-bootstrap-rails gem,在bootstrap_and_overrides.css.less文件中我有下一行:
// If you'd like to override bootstrap's own variables, you can do so here as well
// See http://twitter.github.com/bootstrap/less.html for their names and documentation
//
// Example:
// @linkColor: #ff0000;
Run Code Online (Sandbox Code Playgroud)
但是当我取消注释时,@linkColor: #ff0000;我收到以下错误:
Invalid CSS after "...icons-halflings": expected ")", was ".png"");"
Run Code Online (Sandbox Code Playgroud)
我做错了什么,或者是lib的问题?
给定一个 GitPython Commit 对象,如何获取与此提交相关的标签?
我喜欢有这样的东西:
next(repo.iter_commits()).tags
Run Code Online (Sandbox Code Playgroud) 我有代码:
if (self.annotations) [self.mapView addAnnotations:self.mapView.annotations];
NSLog(@"mapView: %@, anos:%@",self.mapView,self.mapView.annotations);
Run Code Online (Sandbox Code Playgroud)
我得到下一个输出格式日志:
2012-04-26 14:35:53.823 FlickrClient[46441:11603] mapView: <MKMapView: 0x79c8b50; frame = (0 0; 320 367); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x79c62b0>>, anos:(
)
Run Code Online (Sandbox Code Playgroud)
所以据我所知,注释没有添加mapView
到此代码之前,我有下一个日志记录的东西:
for (id i in self.annotations)
{
NSLog(@"%@, %i",i,[i conformsToProtocol:@protocol(MKAnnotation)]);
}
Run Code Online (Sandbox Code Playgroud)
它给出了:
...
2012-04-26 14:35:53.766 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a590>, 1
2012-04-26 14:35:53.767 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a5a0>, 1
2012-04-26 14:35:53.767 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a5b0>, 1
2012-04-26 14:35:53.819 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a5c0>, 1
2012-04-26 14:35:53.819 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a5d0>, 1
2012-04-26 14:35:53.819 …Run Code Online (Sandbox Code Playgroud)