我的客戶/要求我根據日期設置MKMapView上發現的各種不同地標的不透明度(alpha)。根據日期設置Alpha
對於最早的一半地點標記,他希望不透明度設置爲0.5。
我可以通過計算地點標記的索引並檢查它是否位於數組的最後一半來完成此操作。
int indexOfPlacemark = [fixes indexOfObject:fix]; //fixes is the array of Placemarks (named fix).
if (index <= [fixes count]/2) {
[annotationView setAlpha:0.5];
}
else {
// do something with fix.date to work out the opacity.
// an example of the date is Sun, May 15, 2011 - 12:00:44
}
但是,他希望我根據日期提高其他地方標記的不透明度。即最新日期的不透明度爲1.0,陣列前半部分的最早日期爲〜0.5。
我想知道的是我如何根據日期確定不透明度。
謝謝先進。
XcodeDev