nsindexpath

iOS: reload single cell of UICollectionView

早过忘川 提交于 2019-12-01 03:37:19
I am trying to follow the following post on reload a cell in a UICollectionView: UICollectionView update a single cell I know that I ultimately want something that looks like this: [self.collectionView reloadItemsAtIndexPaths:??]; But I don't know how to find and pass the indexPath of a particular cell. Can anyone provide any pointers? I have an NSMutableArray that contains all the cell information (imageViews that are generated in each cell). Ideally, what I'd like to do is pass the index of the NSMutableArray to refresh the corresponding cell on the page. But I'm not sure how the numerical

iOS 7 beginUpdates endUpdates inconsistent

本小妞迷上赌 提交于 2019-11-30 19:27:27
Edit : The solution for this answer is related to iOS7 sometimes returning NSIndexPath and other times returning NSMutableIndexPath . The issue wasn't really related to begin/endUpdates , but hopefully the solution will help some others. All - I'm running my app on iOS 7, and I'm running into problems with the beginUpdates and endUpdates methods for a UITableView . I have a tableview that needs to change the height of a cell when touched. Below is my code: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // If our cell is selected, return double

iOS UITableView Scroll to bottom of section

随声附和 提交于 2019-11-30 11:43:22
I am going to make a tableview with 2 sections inside it. I can add cells to every section programmatically and when i add, i scroll to the end of tableview using [_tableView setContentOffset:CGPointMake(0, CGFLOAT_MAX)]; My question is how can i scroll to the end of the section 0, so that when user add a cell to section 0, tableview scroll dynamically to the last cell in section 0. thanks. Benetz You can try with this code: int yourSection = 2; int lastRow = [tableView numberOfRowsInSection:yourSection] - 1; [tableView scrollToRowAtIndexPath:[NSIndexPath lastRow inSection:yourSection]

Refresh certain row of UITableView based on Int in Swift

我们两清 提交于 2019-11-30 10:21:22
问题 I am a beginning developer in Swift, and I am creating a basic app that includes a UITableView. I want to refresh a certain row of the table using: self.tableView.reloadRowsAtIndexPaths(paths, withRowAnimation: UITableViewRowAnimation.none) and I want the row that will be refreshed to be from an Int named rowNumber The problem is, I don't know how to do this and all the threads I've searched are for Obj-C Any ideas? 回答1: You can create an NSIndexPath using the row and section number then

How can I get indexPath.row in cell.swift

女生的网名这么多〃 提交于 2019-11-30 03:03:13
I have 2 files. myTableViewController.swift myTableCell.swift Can I get the indexPath.row in myTabelCell.swift function? Here is myTableCell.swift import UIKit import Parse import ActiveLabel class myTableCell : UITableViewCell { //Button @IBOutlet weak var commentBtn: UIButton! @IBOutlet weak var likeBtn: UIButton! @IBOutlet weak var moreBtn: UIButton! override func awakeFromNib() { super.awakeFromNib() } @IBAction func likeBtnTapped(_ sender: AnyObject) { //declare title of button let title = sender.title(for: UIControlState()) //I want get indexPath.row in here! } Here is

Refresh certain row of UITableView based on Int in Swift

不羁的心 提交于 2019-11-29 20:06:52
I am a beginning developer in Swift, and I am creating a basic app that includes a UITableView. I want to refresh a certain row of the table using: self.tableView.reloadRowsAtIndexPaths(paths, withRowAnimation: UITableViewRowAnimation.none) and I want the row that will be refreshed to be from an Int named rowNumber The problem is, I don't know how to do this and all the threads I've searched are for Obj-C Any ideas? Lyndsey Scott You can create an NSIndexPath using the row and section number then reload it like so: let indexPath = NSIndexPath(forRow: rowNumber, inSection: 0) tableView

NSFetchedResultsController prepend a row or section

烈酒焚心 提交于 2019-11-29 20:01:41
I have a UITableView populated with a standard NSFetchedResultsController. However I'd like to prepend a row or a section (row preferably but either would works fine really.) The only way I can possibly see doing this right now is to rewrite all the NSIndexPath's manually when dealing with the section/rows dealing with the data from NSFetchedResultsController to trick it into seeing section at index 0 and starting with row at index 0. This however seems like a really bad idea that would quickly get confusing so I'd like to preferable avoid that. A good example of this would be in the official

iOS UITableView Scroll to bottom of section

▼魔方 西西 提交于 2019-11-29 17:24:23
问题 I am going to make a tableview with 2 sections inside it. I can add cells to every section programmatically and when i add, i scroll to the end of tableview using [_tableView setContentOffset:CGPointMake(0, CGFLOAT_MAX)]; My question is how can i scroll to the end of the section 0, so that when user add a cell to section 0, tableview scroll dynamically to the last cell in section 0. thanks. 回答1: You can try with this code: int yourSection = 2; int lastRow = [tableView numberOfRowsInSection

Given model object, how to find index path in NSTreeController?

旧巷老猫 提交于 2019-11-29 06:55:35
Given model objects that NSTreeController represents, how do you find their index paths in the tree and subsequently select them? This seems to be a blindingly obvious problem, but I can't seem to find any reference to it. Any ideas? Rob Keniger There's no "easy" way, you have to walk the tree nodes and find a matching index path, something like: Objective-C: Category @implementation NSTreeController (Additions) - (NSIndexPath*)indexPathOfObject:(id)anObject { return [self indexPathOfObject:anObject inNodes:[[self arrangedObjects] childNodes]]; } - (NSIndexPath*)indexPathOfObject:(id)anObject

How can I get indexPath.row in cell.swift

微笑、不失礼 提交于 2019-11-29 00:37:57
问题 I have 2 files. myTableViewController.swift myTableCell.swift Can I get the indexPath.row in myTabelCell.swift function? Here is myTableCell.swift import UIKit import Parse import ActiveLabel class myTableCell : UITableViewCell { //Button @IBOutlet weak var commentBtn: UIButton! @IBOutlet weak var likeBtn: UIButton! @IBOutlet weak var moreBtn: UIButton! override func awakeFromNib() { super.awakeFromNib() } @IBAction func likeBtnTapped(_ sender: AnyObject) { //declare title of button let title