nsindexpath

UITableViewCell reuse and selection stratergies.

All: I have been fighting with an issue which has been bugging me for the past few days. I have a UIPageControl and in each page I have a UITableView. Each tableView can have upto 4 cells. A user can make a selection, go to next page and select something else. I want to retain the selection in each page, so the user can change his/her ...

Is it possible to get array of all index paths for the cells in a UITableView?

Is there a simple way to get array of all index paths for the cells in a UITableView? ...

Converting between unique NSIndexPath and unique NSUInteger (or int)

Is there a better way than what is proposed here to create a one-to-one mapping between an table view cell's NSIndexPath and a unique NSUInteger or int, in order to create a unique tag property value for a widget in the cell (a UIProgressView)? The link adds methods through a UIKit category extension that converts between NSIndexPath an...

NSIndexPath warnings in Obj-C

Hi All, I am getting a warning while creating the NSIndexPath, NSInteger arr[] = {0,3}; [NSIndexPath indexPathWithIndexes:arr length:2] warning: pointer targets in passing argument 1 of 'indexPathWithIndexes:length:' differ in signedness What is the warning due to ?? How to make it work? Thanks ...

How to create NSIndexPath for TableView

I need delete row 1 of a table in a function i have defined. In order to use deleteRowAtIndexPath you must use an IndexPath with a section and row defined. How can I create an indexpath like this? An array with the int {1} as it's only member will crash; the nslog message states that the section needs to be defined as well. *Edit -> ...

How to restore the user-location in a drill down UITableViewController structure?

I have a CoreData model that contains Levels which can again contain childLevels. I represent each level with a UITableViewController listing all childLevels. When a user taps a row a new UITableViewController is pushed onto the navigationController. No problem here. How would I go about storing the user location within this table str...

Customize TableviewCell depending on section

Hi folks, How do I customize the background image of a tableViewCell depending on the section, they are in? E.g. in section one, the cells are supposed to have a green .png image as a background image, whereas in section two, the cells are supposed to have a red .png image as background. Thank you for your help! gstar ...

how can i get a uitableViewCell by indexPath?

how can i get a uitableViewCell by indexPath? like this: i use the UIActionSheet when i click confirm button i wan to change the cell text the nowIndex i defin as a property - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0){ NSInteger section = [nowIndex section]; ...

UITableView Cell IndexPath

Hello, Can anyone tell me how can I get a cell IndexPath? I was saving the IndexPath in the tableView: cellForRowAtIndexPath: method but this only loads when the cell is viewed and I need to know its index path on the viewDidLoad method. this resulted in a null value because as I said it only loads its value after the cell was viewed on...

containsObject - why doesen't this work?

Hi. I have an array that I am trying to check wether or not an indexPath(.row) exists in. I use this code: if ([array containsObject:[NSNumber numberWithInt:indexPath.row]]){ NSLog(@"Yep, it exists in there."); } the array consist of the numbers 3, 8 and 2. The index path loads numbers fromm 0 to 8 in a loop. Can anybody see wh...

Array, find object with value and get its indexPath

Hey. I am trying to find an item in a NSMutableArray from it's value, only to find its indexPath. I have absolutely no idea of how to do this, as I am very new to programming in general. Thanks! ...

Get a tableview insertRowsAtIndexPaths to accept indexOfObject?

Hey. I have a code snippet that looks like this: [tableView beginUpdates]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft]; [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[array indexOfObject:[array objectAtIndex:indexPath.row]]] withRowAnimation:UITa...

comparing indexPaths in a loop iphone

I am trying to compare an index path in my didSelectRowAtIndexPath delegate method with an array of index paths. for (n=0; n < [tempMutArrray count]; n= n+1){ NSComparisonResult *result = [indexPath compare:[tempMutArray objectAtIndex:n]; //What I want to do is is write an if statement that executes a certain block of code //if...

iPhone UITableView populating variable rows sections from flat array

I thought that would be very common and easy iPhone App. In the main app I connect to database, retrieve values from database (NSDate converted to NSString)n and put into single array. Then in one of the views I populate UITableView with elements from the array. UITableView is grouped (sections). I step through array to discover number o...

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

Hey. Recently edited to adapt to some answers and to improve readability 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 ...

UITableView Checklist

Hey everyone, I'm making a checklist program using UITableView and I managed to implement everything up to selection and making a checkmark appear. However, when I scroll away from the cells. The checkmark disappears. I have the following code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath...

UITableViewCell - Play Multiple Movie Files from an Array

Hello All iOS4 - iPhone 4 & 3GS I have a Table based application using Custom UITableViewCell's. The custom Cell has a UIButton within it for playing a movie file. At the moment I have Arrays to populate the information within each cell depending on the Indexpath. All information within the Cell is placed within cellForRowAtIndexPath a...

NSOutlineView selection binding error

Hi I got the next situation: NSOutlineView <-> NSTreeController <-> MyClass I bind the NSTreeController to an array of objects in MyClass, now I want to get the selected item from the NSOutlineView. For this i declare a NSMutableIndexSet and bind it to the NSTreeController via the "Selection Index Paths" binding how is bound to the NSO...

Dynamic Sections UITableView with Unknown cells

Hey, I'm basically trying to retrieve data from SQlite db and populate a tableView from it. The sql-data-retrieval method creates two arrays. "dataArray" and "SectionArray". DataArray is filled with data NSObjects. Uptil this point, i can create the appropriate Section headers. Here is the problem, -1 What do i do to make sure th...

Crash when using indexPath.row in a modalViewController

Hi, I've a problem with indexPath.row, when I try to access this variable my app crashes and I get no errors on the console :( the code is this: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. NSLog(@"%@", ind...