how I can use an NSMutableArray
of NSMutableDictionary's
in an NSTableView
using Cocoa? Can any one pls suggest me with proper solution?
Asked
Active
Viewed 720 times
0
-
http://stackoverflow.com/questions/4081632/how-to-bind-data-to-a-nstableview-from-a-nsdictionary – iPatel Jan 22 '13 at 05:46
-
are you intended to use binding or coding? – Anoop Vaidya Jan 22 '13 at 07:12
-
In other words, Cocoa Bindings, or writing your own controller code? – paulmelnikow Feb 17 '13 at 20:57
-
Voting as not a duplicate, since the duplicate question is about Cocoa Bindings, and it's not clear that OP really intends to use bindings. – paulmelnikow Feb 17 '13 at 20:58
1 Answers
0
Consider the following example:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// I will use tempDict Object for your understandings, otherwise it can be used directly. Here array1 is Main DataSource for UITableView.
NSDictionary *tempDict = [array1 objectAtIndex:indexPath.row];
// key1 is the key to get the object from the dictionary.
cell.title.text = [tempDict valueForKey:key1];
return cell;
}
Here, array1 is the main DataSource
for your table view, which contains NSDictionary
objects.
Hope this helps.

viral
- 4,168
- 5
- 43
- 68
-
If it solved your problem, please click the check-mark outline next to the answer. – paulmelnikow Feb 17 '13 at 20:56