fel*_*mer 6 cocoa-touch ios uicollectionview uicollectionviewcell swift
我有一个集合视图,我想在其中显示每小时的天气。我似乎在加载单元格时遇到问题,并且由于某种原因向前滚动然后向后滚动完全加载单元格。在我滚动集合视图之前,所有约束都不起作用,并且一个标签不显示其信息。
\n\n\n\n\n\nfunc numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {\n // #warning Incomplete implementation, return the number of sections\n return 1\n}\n\n\nfunc collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n // #warning Incomplete implementation, return the number of items\n return newhourlyWeather.count\n}\n\nfunc collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {\n let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! hourlyWeatherCell\n\n // Configure the cell\n\n let hWeather = newhourlyWeather[indexPath.row]\n\n if let HourlyTemp = hWeather.temperatureh {\n cell.temperatureHLabel.text = "\\(HourlyTemp)\xc2\xba"\n }\n\n if let HourlyTime = hWeather.convertedTimeH {\n cell.timeHLabel.text = "\\(HourlyTime)"\n }\n\n if let HourlyRain = hWeather.precipProbabilityh {\n cell.rainChanceHLabel.text = "\\(HourlyRain)%"\n }\n\n cell.iconhView.image = hWeather.iconh\n\n return cell\n\n self.collectionView.reloadData()\n}\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
4125 次 |
| 最近记录: |