2016-11-08 38 views
0

我知道這聽起來很簡單,但默認情況下,GoogleMaps的默認功能iconView的默認alpha爲0.9。我試圖將其更改爲1,但它仍然是一樣的。任何建議?提前致謝。如何在GoogleMaps中刪除iconView的alpha?

[編輯] 這是我的代碼

 let cView = UIView(frame: CGRectMake(0,0,400*PT,300*PT)) 
     let innerView = UIView(frame: CGRectMake(0,0,400*PT,190*PT)) 
     innerView.backgroundColor = UIColor.whiteColor() 
     innerView.layer.cornerRadius = 3 
     innerView.layer.masksToBounds = true 
     innerView.alpha = 1 
     cView.addSubview(innerView) 
     let cIcon = UIImageView(frame: CGRectMake(0*PT, 200*PT, 90*PT, 100*PT)) 
     cIcon.image = UIImage(named: "1.png") 
     cView.addSubview(cIcon) 
     cView.backgroundColor = UIColor.clearColor() 
     item.iconView = cView 

[編輯]輸出 新增截圖

enter image description here

[編輯]下面的答案後 最終輸出

enter image description here

+0

[不透明度被設定在GMSMarker](https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_marker.html#ab3a0c24528927eeba06b01e23070e823),未標記的'iconView',和它默認爲'1'。 'iconView'也不是一個函數。 –

+0

我明白了,但如果您嘗試使用iconView,則可以看到背景幾乎不可見,就像它的alpha爲0.9。所以我試圖將我添加到iconView的customView設置爲alpha = 1,但它不起作用。 –

回答

1

可能有點顯而易見,但你可以嘗試添加嗎?

item.opacity = 1 
+0

好的,我會試試看。 –

+0

謝謝,它的工作原理。 –