如何在Map视图中更改rightCalloutAccessoryView的注释视图按钮的图像?我使用了以下方法在注释视图中设置按钮。
annotationView!.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
(annotationView?.rightCalloutAccessoryView as! UIButton).setImage(UIImage(named: "abc"), for: .normal)
我也试过自定义按钮,它不会改变
答案 0 :(得分:1)
Swift 4
创建按钮,设置图像并在rightCalloutView中指定。
public function imports($aid)
{
$file_data = $this->csvimport->get_array($_FILES["csv_file"]["tmp_name"]);
foreach(array_slice($file_data, 1) as $row)
{
$pid = $this->m_csvimport->getid($row["nip"]);
$array [] =array(
'aid' => $aid,
'pid' => $pid,
'kodeunik' => '',
);
}
/* print_r($array) to check the data */
$this->m_csvimport->inserts($array);
}
答案 1 :(得分:0)
尝试以这种方式创建Button
,设置image
并将Button
设置为rightCalloutAccessoryView
。
let button = UIButton(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
button.setImage(UIImage(named: "abc"), for: .normal)
annotationView!.rightCalloutAccessoryView = button
答案 2 :(得分:0)
SWIFT 3.0 试试这个 您可以在标注中设置服务器URL图像。
func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
marker.tracksInfoWindowChanges = true
let CustomWindowDisplay:CustomWindow = Bundle.main.loadNibNamed("View", owner: self, options: nil)![0] as! CustomWindow
let arrImages:NSArray = (dictDataOfPropertyData.value(forKey: "property_images") as? NSArray)!
if arrImages.count != 0{
let strImage:String = (arrImages1.object(at: 0) as! NSDictionary).value(forKey: "property_photo") as! String
let urlofImg:NSURL = NSURL.init(string: strImage)!
CustomWindowDisplay.imgPropertyPhoto.sd_setImage(with: urlofImg as URL, placeholderImage: UIImage(named: "placeholder_main_list.png"), options: .highPriority)
}
}