I have used UICollectionView Cells for my app. It is populated by Arrays.
I have two CollectionView Sections. Section '0' & Section '1' has it's own cells populated with arrays.
There are multiple cells in section 1.
I want to enable user to rearrange cells within section 1. User should not be able to move cell from section 1 to section 0.
I am using following code but It is giving me errors...
I tried searching on the web but I didn't got the answer so I am posting it here for help...
override func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
let sourceSection = sourceIndexPath.section
let destSection = destinationIndexPath.section
if (sourceSection destSection) {
let tempInputDataArray = inputDataArray.remove(at: sourceIndexPath.item)
inputDataArray.insert(tempInputDataArray, at: destinationIndexPath.item)
UserDefaults.standard.set(inputDataArray, forKey: "KeyForInputDataArray")
for element in inputDataArray {
print(element)
}
} else {
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have deployed 2 Supplementary Views for Header and Footer views for my collection view.
Header '0' has UILabel text which dynamically sets data dynamically after transitioning to push secondary view controller.
But I am having problem that when UILabel in header loads again after returning and taking data from secondary view controller collection view get updated but Header and Footer Supplementary views has overlapping of old and new data...!!!
How to fix overlapping of data and 'Reload Supplementary Views' for Header and Footer?
I have used UITextField to get date input using UIDatePicker.
If user has attached external Bluetooth keyboard to his iPad or Mac (Catalyst) I want to block user input from keyboard and force user to use UIDatePicker instead to get in put in valid date format e.g. dd/MM/YYYY
How to do it in Swift app? Do help...