I know this question is duplicate but i tried this solution and works fine......
var data = [GroupsModel]()
import Foundation
import UIKit
class GroupsModel {
var strgroupName : String?
var imgGroupProfilePicture : String?
var numNotificationCount : Int32 = 0
var numGroupmembersCount : Int32 = 0
var groupID : String?
var GroupStatus : String?
init?(strgroupName : String , imgGroupProfilePicture : String? , numNotificationCount : Int32 , numGroupmembersCount : Int32 , groupID : String, GroupStatus : String)
{ print("Initilaised")
self.strgroupName = strgroupName
self.imgGroupProfilePicture = imgGroupProfilePicture
self.numNotificationCount = numNotificationCount
self.numGroupmembersCount = numGroupmembersCount
self.groupID = groupID
self.GroupStatus = GroupStatus
}
}
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
// return 2
return 1
}
// Retuens the number of sections in collectionview
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
{
// if section == 0 {
return data.count
//}else if section == 1{
// return 1
//}else {
//}
//return 0
//}
}
// override func viewWillAppear(animated: Bool) {
//
// if let indexPath = oldIndexPath as NSIndexPath! {
//
// self.outDragDropCollectionView.reloadItemsAtIndexPaths([indexPath])
// Data get's filled into UICollectionView
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell
{
var cell : CollectionCell!
// if indexPath.section == 0 {
if indexPath.item == (data.count - 1) {
cell = collectionView.dequeueReusableCellWithReuseIdentifier("collectionViewCell", forIndexPath: indexPath) as! CollectionCell
//
// cell.addSocket.image = UIImage(named: "Add Sprocket")
cell.imgGroupProfileImage.image = UIImage(named: "Add Sprocket")
//set up the "+" cell
}
else {
cell = collectionView.dequeueReusableCellWithReuseIdentifier("collectionViewCell", forIndexPath: indexPath) as! CollectionCell
let _data = data[indexPath.row]
cell.GroupStatus.text! = _data.GroupStatus!
let GroupStatusResult = cell.GroupStatus.text!
print("GroupStatus (GroupStatusResult)")
if GroupStatusResult == "False" {
print("Here For Invite")
let urlstring = "http://Content/Default/invite.png"
let url = NSURL(string: "(urlstring)")
print("Url ; (url)")
cell.imgGroupProfileImage.kf_setImageWithURL(url!, placeholderImage: nil,
optionsInfo: [.Transition(ImageTransition.Fade(1))],
progressBlock: { receivedSize, totalSize in
// print("(indexPath.row + 1): (receivedSize)/(totalSize)")
},
completionHandler: { image, error, cacheType, imageURL in
//print("(indexPath.row + 1): Finished")
})
cell.imgGroupProfileImage.layer.cornerRadius = cell.imgGroupProfileImage.frame.width / 2
cell.imgGroupProfileImage.clipsToBounds = true
cell.AcceptButton.hidden = false
cell.AgroupInvite.hidden = false
cell.notificationBadge.hidden = true
cell.AcceptButton.addTarget(self, action: "AcceptTapped:", forControlEvents: .TouchUpInside)
}else{
//cell.backgroundColor = colors[indexPath.row]
print("Herre For Group List)")
cell.lblGroupName.text = _data.strgroupName
let Gi = _data.groupID!
print("(Gi)")
cell.lblGroupId.text! = Gi
GroupId = cell.lblGroupId.text!
cell.imgGroupProfileImage.kf_showIndicatorWhenLoading = true
print("url string : (_data.imgGroupProfilePicture)")
let urlstring = _data.imgGroupProfilePicture!
let url = NSURL(string: "(urlstring)")
print("Url ; (url)")
cell.imgGroupProfileImage.kf_setImageWithURL(url!, placeholderImage: nil,
optionsInfo: [.Transition(ImageTransition.Fade(1))],
progressBlock: { receivedSize, totalSize in
// print("(indexPath.row + 1): (receivedSize)/(totalSize)")
},
completionHandler: { image, error, cacheType, imageURL in
//print("(indexPath.row + 1): Finished")
})
// cell.update((indexPath as NSIndexPath).row)
cell.imgGroupProfileImage.layer.cornerRadius = cell.imgGroupProfileImage.frame.width / 2
cell.imgGroupProfileImage.clipsToBounds = true
// let tapGesture = UITapGestureRecognizer(target: self, action: Selector("processTap:"))
// cell.imgGroupProfileImage.userInteractionEnabled = true
// cell.imgGroupProfileImage.addGestureRecognizer(tapGesture)
}
// set up the standard cell, using the data from the army
}
return cell
}
but By doing this solution 2 section is their so that it is displaying in different section....
i just want to display it in 4 place... it is placed in 5th place... please help me... thanks in advance..
Aucun commentaire:
Enregistrer un commentaire