Questions tagged [indexpath]

167 questions
1
vote
1 answer

adding Button in last tableView Cell shown twice when scrolling

Using Swift4, iOS11.2.1, Xcode9.2, I successfully added a custom button to the last cell of a tableView. (the button is used to add cells in the tableView - this also works fine...) - see Screenshot-1. But now the issue: When adding more cells (i.e.…
iKK
  • 6,394
  • 10
  • 58
  • 131
1
vote
2 answers

iOS - NSInternalInconsistencyException happens on iOS 9 and 10 but working fine on iOS 11

This is the error I am getting on devices with iOS 9 and 10 : *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for number of items before section 9223372036854775807 when there are only 1 …
user7219266
1
vote
2 answers

Not able to delete row at an indexpath

I have some tableview cells with some data on them and the cells have a cross button on them (at the top right) on the click of which the cell should get deleted. This is how I'm trying to delete... extension sellTableViewController: imageDelegate…
user8894520
1
vote
3 answers

Swift - How to do specific action on last row of a UITableView when the last row isn't visible?

I am trying to achieve a custom action on the last row of my UITableView. I found a nice extension in order to know if I'm on the last row : extension UITableView { func isLast(for indexPath: IndexPath) -> Bool { let indexOfLastSection…
user7219266
1
vote
3 answers

swift heightForRowAt indexPath not update

With this code I set automatic dimension of a cell based on the number of items in array. It works, but when I add some new item with another viewController and then return to this the height does'n update even if the number of array get…
HaVaNa7
  • 330
  • 1
  • 3
  • 14
1
vote
1 answer

CollectionView - Fatal error: index out of range - More cells than the view can show

I'm having a CollectionView Fatal error: Index out of range when reloading data with UIRefreshControl. The collection is configured like this: override func numberOfSections(in collectionView: UICollectionView) -> Int { // #warning Incomplete…
1
vote
0 answers

Viewforheaderinsection not called for last section in swift?

Helll all, I have added sections in the list.I have total 8 sections.Now on the last section i have a row on which i have added a button.On tap of button i open imagepicker.When i cancel the picker Viewwillappear is called & i reload the…
TechChain
  • 8,404
  • 29
  • 103
  • 228
1
vote
1 answer

Sections in UITableView with Custom Cells

I have the following code thus far. var someData = [SomeData]() func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { let cell =…
David Henry
  • 1,972
  • 20
  • 43
1
vote
3 answers

UITableView Index Path Behavior Acting Strange

So I have a table view with about 150ish rows in the cellForRowAt method I have the following code cell.monthLabel.text = String(indexPath.row) if indexPath.row == 0{ cell.backgroundColor = .blue } The question is why at index path 9, 18,…
Ross Sullivan
  • 396
  • 1
  • 3
  • 13
1
vote
1 answer

Can't push cell data in UITableViewCell to new UITableViewController

I'm new to coding, but I've been working on the same issue for days. I'm trying to push the menuItem to join an array in a new view controller scene called OrderController when the cell row is selected. menuItem is a class, and it gets added to an…
HappyMouse
  • 93
  • 1
  • 6
1
vote
4 answers

ERROR: Attempt to insert item 0 into section 0, but there are only 0 items in section 0 after the update

My code: DataService.dataService.fetchDataFromServer { (channel) in self.channels.append(channel) let indexPath = IndexPath(item: self.channels.count - 1, section: 0) self.collectionView?.insertItems(at: [indexPath]) …
Rohan Vasishth
  • 417
  • 6
  • 19
1
vote
1 answer

I want to get specific data with clicking on collection view cell with parsing Json

I have a collection view and Json array. I Want to get specific data on another view by tapping collection view cell. I used to get data by using tags on buttons on main view, but when I changed view with collection view, now theres no separate…
SunCode
  • 43
  • 10
1
vote
4 answers

iOS TableView Index Value on Scroll

I am using table view in my Swift project. The problem is with table view cell index path value. When the table gets loaded initially, the index values are ok. But as soon as I scroll my table view the cell index paths change and the ids I get from…
Ali
  • 5,021
  • 4
  • 26
  • 45
0
votes
0 answers

I want to delete a message from a chat using messageKit

Use messageKit with Firebase When I delete any message in the chat using long press, it gets deleted in front of me, but when I leave the chat and come back, it is not actually deleted. override func collectionView(_ collectionView:…
Raeed
  • 1
  • 1
0
votes
1 answer

Posts are hiding under the Second Cell In CollectionView

i ma making Swift app with Xcode and using CollectionViewCell to fetch data from my WordPress Website. i have 2 cells in my CollectionView , one for loading posts and second for Google AdMob , I want to show Ads after 4 posts which is working great…