nsindexpath

Objective-C: How to convert NSIndexSet to NSIndexPath

烂漫一生 提交于 2020-06-26 05:03:34
问题 I would like to convert NSIndexSet Object to NSIndexPath,as effect as link: https://developer.apple.com/reference/photos/phphotolibrarychangeobserver?language=objc - (void)photoLibraryDidChange:(PHChange *)changeInfo { // Photos may call this method on a background queue; // switch to the main queue to update the UI. dispatch_async(dispatch_get_main_queue(), ^{ // Check for changes to the displayed album itself // (its existence and metadata, not its member assets). PHObjectChangeDetails

cellForRowAtIndexPath: crashes when trying to access arrays objectAtIndex:indexPath.row

拜拜、爱过 提交于 2020-01-11 12:05:59
问题 I am loading in data to a UITableView , from a custom UITableViewCell (own class and nib). It works great, until I try to access the objectAtIndex:indexPath.row for some arrays. I'll post my code first, it will probably be easier for you to understand what I mean then. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CustomCell"; CustomCell *cell = (CustomCell *) [tableView

iOS 7 beginUpdates endUpdates inconsistent

情到浓时终转凉″ 提交于 2020-01-11 02:03:26
问题 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 *

NSInvalidArgumentException when deleting cell using a different class

扶醉桌前 提交于 2020-01-07 02:35:11
问题 Update for code: Following on Matthew's answer I tried correcting my code to be more correct. Now the code does delete the cell but also crashes and gives an error: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' The code below is from an action called checkboxTapped which is in my CustomCell code. Once action is fired it gives the error. I figured out that my

Passing parameters in self action:@selector

半腔热情 提交于 2020-01-04 12:08:25
问题 I am trying to add a NSIndexpath as parameter to a method through [self action:@selector(showDetailedImage)]; Is it possible to add an extra parameter( NSIndexPath ) to this method? 回答1: No, you can not pass arguments , you can only show that this selector will take that many numbers of arguments. If you need to do this, you can create a property and access it from the method showDetailedImage . However you can use this selector: [self performSelector:@selector(showDetailedImageIndex:)

Issues using NSIndexPath as key in NSMutableDictionary?

点点圈 提交于 2020-01-01 08:53:34
问题 Is there any particular reason why attempting to store and retrieve a value in an NSMutableDictionary using an NSIndexPath as a key might fail? I originally attempted to do this in order to store an NSMutableDictionary of UITableViewCell heights ( self.cellHeights ) for a UITableView . Each time you tapped a UITableViewCell , that cell would either expand or contract between two different heights based on the value stored in the NSMutableDictionary for that particular indexPath : - (CGFloat

Issues using NSIndexPath as key in NSMutableDictionary?

此生再无相见时 提交于 2020-01-01 08:53:09
问题 Is there any particular reason why attempting to store and retrieve a value in an NSMutableDictionary using an NSIndexPath as a key might fail? I originally attempted to do this in order to store an NSMutableDictionary of UITableViewCell heights ( self.cellHeights ) for a UITableView . Each time you tapped a UITableViewCell , that cell would either expand or contract between two different heights based on the value stored in the NSMutableDictionary for that particular indexPath : - (CGFloat

Creating slow scrolling to indexPath in UICollectionView

送分小仙女□ 提交于 2019-12-28 04:01:10
问题 I'm working on a project where I'm using a UICollectionView to create an 'image ticker' where I'm advertising a series of logos. The collectionView is one item high and twelve items long, and shows two to three items at a time (depending on size of the logos visible). I would like to make a slow automatic scrolling animation from the first item to the last, and then repeat. Has anyone been able to make this work? I can get the scrolling working using [myCollection scrollToItemAtIndexPath:

UITableView Checkmarks at the wrong place after search

邮差的信 提交于 2019-12-25 18:36:33
问题 I want to search in my tableView, set checkmarks and save the objects with the checkmarks in Realm. But if I set a checkmark after a search and cancel the search, the checkmark is at the indexPath that I clicked on, and not at the object. I can't explain it better, so here's an example: After I search an exercise. After I clicked the cancel button Here's my code: class ShowExcercisesTableViewController: UITableViewController, UISearchResultsUpdating, UISearchBarDelegate { //Properties let

Pass value with action sheet button

こ雲淡風輕ζ 提交于 2019-12-25 07:54:17
问题 I created an ActionSheet with action of button. I have button that opens the action sheet and the ActionSheet button opens new viewController . The problem is that the button which opens the action sheet is inside tableview cell and I do not know how to pass value with this button. The concept should be something like this but with the action sheet button: actionSheet.addAction(UIAlertAction(title: "Edit it", style: UIAlertActionStyle.destructive, handler: { (ACTION :UIAlertAction!)in //here