我想在当前用户位置标注中添加正确的附件按钮.我发现了一些关于这个主题的问题,但它们似乎对我没用.这是我到目前为止的代码,我已经成功地将正确的附件按钮放到我的其他注释上:
- (MKAnnotationView *)mapView:(MKMapView *)_mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
//TODO: this doesn't seem to be working?
if ([annotation isKindOfClass:[MKUserLocation class]]) {
MKAnnotationView * aV = [mapView viewForAnnotation:annotation];
aV.canShowCallout = YES;
aV.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
return nil;
}
return nil;
}
Run Code Online (Sandbox Code Playgroud)
我在几个地方读过,解决方案是为用户位置制作一个自定义的MKAnnotationView,但我还没有看到如何为用户位置做这个演示的演示 - 我已经成功地为其他注释做了这个我的地图.
示例代码将是最有帮助的,谢谢!
我有简单的旋转变换,结合alpha,在第一次调用时效果很好,但第二次旋转不会发生(用户通过点击屏幕启动此动画).
这是我的基本动画功能:
- (void) animateMe:(UIImageView *)myImage delay:(NSTimeInterval)dly
{
[UIView animateWithDuration:1.0
delay:dly
options:UIViewAnimationOptionAutoreverse
animations:^(void){
myImage.alpha = 1.0;
myImage.transform = CGAffineTransformMakeRotation(180.0);
}
completion:^(BOOL finished) {
myImage.alpha = 0.0;
}];
}
Run Code Online (Sandbox Code Playgroud) 我想初始化 ValueTuples 的静态只读数组,我想使用此答案中的方法:
var tupleList = new (int Index, string Name)[]
{
(1, "cow"),
(5, "chickens"),
(1, "airplane")
};
Run Code Online (Sandbox Code Playgroud)
但它不适用于静态成员,我必须声明 tupleList 的类型。我可以像这样将其作为元组来执行,但我不知道如何将其作为 ValueTuple 来执行:
static readonly Tuple<uint, string>[] tupleList= new Tuple<uint, string>[]
{
new Tuple<uint, string>(0x1, "string1"),
...
};
Run Code Online (Sandbox Code Playgroud)
但如果我能找出正确的类型,我更愿意使用更干净的格式,到目前为止,我已经尝试了多种类型,但没有成功。
我想使用SimpleCursorAdapter来填充我的ListActivity,但是我得到了经典的异常,因为我的Cursor中没有'_id'字段.不幸的是,这种类型的查询没有为我提供一个字段,我可以将其用作我的_id字段的形式:
SELECT DISTINCT room from tblRates WHERE resid='ABC' AND date='2011-10-17'
Run Code Online (Sandbox Code Playgroud)
由于DISTINCT我不能只添加_id.那么如何设置自定义适配器呢?
顺便说一句,我已经看过这篇文章,所以我明白为什么我会收到这个错误.只是想知道如何使用我正在做的查询类型获取_id:
我正在使用此代码
$query = mysql_query("SELECT Image, Col2, Col3 FROM table ");
$row = mysql_fetch_array($query);
$content = $row['Image'];
header('Content-type: image/jpg');
echo $content;
echo $row['Col2'];
echo $row['Col3'];
Run Code Online (Sandbox Code Playgroud)
问题是,一旦我做'Content-type: image/jpg'了其他Col2和Col3没有出现.它们不是图像,只是文本行.如何同时显示图像和文本?