nsindexpath

Convert NSInteger to NSIndexpath

China☆狼群 提交于 2019-12-17 22:44:10
问题 Basically I am storing an index of an array in a NSInteger. I now need it as an NSIndexpath, I'm struggling to see and find a way to convert my NSInteger to NSIndexpath so I can reuse it. 回答1: For an int index : NSIndexPath *path = [NSIndexPath indexPathWithIndex:index]; Creates Index of the item in node 0 to point to as per the reference. To use the indexPath in a UITableView , the more appropriate method is NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section]; 回答2: If you

how to access from UICollectionViewCell the indexPath of the Cell in UICollectionView

妖精的绣舞 提交于 2019-12-17 22:17:59
问题 i want to animate the UICollectionViewCell when action is called. i have done UICollectionViewCell in Interface Builder , the UICollectionView also. Now i want to get the correct indexPath at my actionBtnAddToCard method. thats the way i try it now (method in ProduktViewCell.m): - (IBAction)actionAddToCart:(id)sender { XLog(@""); // see this line NSIndexPath *indexPath = ??** how can i access the correct indexPath**??; SortimentViewController *svc = [[SortimentViewController alloc]

UITableViewCell check/uncheck within one section only

大兔子大兔子 提交于 2019-12-13 01:48:35
问题 I'm trying to setup my table so that the user can select one item per section. For example: - Section 0 - Row 0 √ - Row 1 - Section 1 - Row 0 - Row 1 √ - Row 2 So in the above example if the user selects section 0, row 1 then row 0 in the same section should be unchecked and the selected row gets a checkmark. Same goes for section 1 where any selected row should get a checkmark and then I want to remove the checkmark from the previously selected row in the same section. - Section 0 - Row 0 -

NSIndexPath: message sent to deallocated instance

寵の児 提交于 2019-12-12 09:23:34
问题 Any help you can offer would be appreciated. I have a app that has a tableView, detailView, flipView, and moreDetail View. It is fine moving through the transitions until the 26th element. The app crashes when I hit buttons that navigate to the flip and moreDetailView. I am given the error Msg: [NSIndexPath row] message sent to deallocated instance . I think I may be calling the indexPath too many times, but why does everything work well up until the 25th element and then stop working? How

Reordering Elements inside Array of UIImage

安稳与你 提交于 2019-12-12 02:49:11
问题 I have an array of NSURL array, and I am able to use functions removeAtIndex and insert . I know the fromIndexPath and toIndexPath and this method helps me to accomplish the same for [[NSURL]] using this Delegate method (check var data below): func moveDataItem(fromIndexPath : NSIndexPath, toIndexPath: NSIndexPath) { let name = self.data[fromIndexPath.section][fromIndexPath.item] self.data[fromIndexPath.section].removeAtIndex(fromIndexPath.item) self.data[toIndexPath.section].insert(name,

How to pass indexPath from segue to destination view?

蹲街弑〆低调 提交于 2019-12-12 01:49:58
问题 I have two buttons in a custom layout collectionView's footer. I want to pass the indexPath of the footerView to destinationView class when user taps the button. I wrote my code in a typical way which I succeeded before. However, in some reason, whenever I tap the button it crashes. I tried different approaches for each button to accomplish this job but neither worked. I have set destinationView's class to the right class in a storyboard. Please somebody help me. Any help with code example

How to pass indexPath from button inside footer to segue?

送分小仙女□ 提交于 2019-12-11 09:31:05
问题 I'm working on a custom layout collectionView which has quilt look and each section has a footer. Two buttons are inside footer and each button has a segue to another view(I set segues using IB). Footer has its own indexPath which was assigned in a UICollectionViewFlowLayout class(Where I made a custom layout). The indexPath of footer is like this - {section - row} {0-0} {1-0} {2-0}.... I want to keep this indexPath information to use at the another view which is linked to two buttons. I

Delete a UILocalnotification at a certain indexpath

半腔热情 提交于 2019-12-11 06:17:57
问题 I have a bunch of UILocalNotifications but I only want to delete a certain one at a given indexpath, therefor [[UIApplication sharedApplication] cancelAllLocalNotifications]; wont work out for me. I know I can use [[UIApplication sharedApplication] cancelLocalNotification:UILocalNotification]; but how do I get the UILocalNotification from the given NSIndexPath? Thanks. 回答1: You can get an array of scheduled notification from: @property(nonatomic,copy) NSArray *scheduledLocalNotifications Get

Accessing indexPath from custom UITableViewCell

人盡茶涼 提交于 2019-12-11 01:39:00
问题 I'm trying to create a UITableView to allow the user to enter data, similar to a lot of the settings UITableViews, with some textfields and callouts to other tableviews for checkboxes. For such a common feature in apps, this does not seem to be very straight forward. I'm having trouble accessing the indexPath.row from my custom UITableViewCell. Here is where I allocate my custom UITableViewCell. UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier

Error when trying to save indexPath to NSUserDefaults

十年热恋 提交于 2019-12-10 18:21:54
问题 I am trying to save the indexPath for UICollectionView, but I get the following error: libc++abi.dylib: terminating with uncaught exception of type NSException My code is: Save index path: [[NSUserDefaults standardUserDefaults] setObject:indexPath forKey:@"CollectionIndex"]; [[NSUserDefaults standardUserDefaults] synchronize]; Load indexPath: NSIndexPath *storedIndexPath = [[NSUserDefaults standardUserDefaults] objectForKey:@"CollectionIndex"]; I have commented out code to find out which code