Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mvkoe

macrumors regular
Original poster
Aug 4, 2008
103
3
Belgium
Hey

The question that I have is how is this "thing" called: (See figure 1)

So basicly when the user tap the + next to the 1 option in the TableView. Then the information come's underneath it in the tableview. the + changes into a -.

This is the process, and i want to know how this is called, it's not really a dropdown menu, because it's populating the TableView.

Figure 1:
6h73on.png
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
It's been years since I did anything fancy like this with UITables, but if I recall correctly there's a data source method that dictates whether a row should show a +, -, both, or neither during editing. There's also a delegate method that is called when the + or - button is pressed.

I suspect that they have it set up to initially show a +, then when you press that + it inserts the two rows with animation, and changes the edit mode of the row from + to -. The table would be in edit mode the whole time. Alternatively, it's possible they just stuck in their own UIButton with the + sign and change it to a - at the right time.
 

Mvkoe

macrumors regular
Original poster
Aug 4, 2008
103
3
Belgium
It's been years since I did anything fancy like this with UITables, but if I recall correctly there's a data source method that dictates whether a row should show a +, -, both, or neither during editing. There's also a delegate method that is called when the + or - button is pressed.

I suspect that they have it set up to initially show a +, then when you press that + it inserts the two rows with animation, and changes the edit mode of the row from + to -. The table would be in edit mode the whole time. Alternatively, it's possible they just stuck in their own UIButton with the + sign and change it to a - at the right time.

And is it possible to add value's between other value's in my Array ?
Like i would have an array:
Person 1 +
Person 2 +

to:
Person 1 +
Things about person 1
Person 2 +
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
Yes, it is possible.

If you're looking for more help with it, I suggest you start posting some code where you attempted to do this and we can point out mistakes you made.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
And is it possible to add value's between other value's in my Array ?
Like i would have an array:
Person 1 +
Person 2 +

to:
Person 1 +
Things about person 1
Person 2 +

Sure, it's possible. But it seems to me that what your table is showing, based on the above example, is people. Without each row expanded, you're showing only minimal information for each person. When a row is expanded (through the use of an accessoryView button), you include more detailed information about that person in the row. Is that the case?

If that's true, I would have an array of Person (model-class instances) as your data-source and then your unexpanded rows show only basic properties of the Person and expanded rows show more. You might need a parallel array to keep track of which rows are expanded.
 

Mvkoe

macrumors regular
Original poster
Aug 4, 2008
103
3
Belgium
Sure, it's possible. But it seems to me that what your table is showing, based on the above example, is people. Without each row expanded, you're showing only minimal information for each person. When a row is expanded (through the use of an accessoryView button), you include more detailed information about that person in the row. Is that the case?

If that's true, I would have an array of Person (model-class instances) as your data-source and then your unexpanded rows show only basic properties of the Person and expanded rows show more. You might need a parallel array to keep track of which rows are expanded.

I would have a plist file where i load my data from. The real data is like this:
rmjs4l.png


So an NSDictonary that hold's my Categories, and in each categorie there is an array of strings.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
I would have a plist file where i load my data from.

Load the plist into your model layer. Then access from there.

I still think you are trying to bite off more than you can chew. You need to concentrate on the fundamentals right now. Have you finished that book yet?
 

Mvkoe

macrumors regular
Original poster
Aug 4, 2008
103
3
Belgium
Load the plist into your model layer. Then access from there.

I still think you are trying to bite off more than you can chew. You need to concentrate on the fundamentals right now. Have you finished that book yet?

I'm always trying to think a bit further then I can handle, so I can learn from the things I want to acomplish. And yeah kinda done with the book

So I already have my data categories in my Tableview, so in did select row, or an button, it should load the data from the array categorie and show it under the categorie like a "dropdown" menu.

Can't you push me in the right direction of how need to handle this ?
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
I'm always trying to think a bit further then I can handle, so I can learn from the things I want to acomplish.
Nothing wrong with that.

And yeah kinda done with the book
Kinda done? What does that mean?

So I already have my data categories in my Tableview, so in did select row, or an button, it should load the data from the array categorie and show it under the categorie like a "dropdown" menu.

Can't you push me in the right direction of how need to handle this ?

Have you considered using a drill-down approach rather than a drop-down?

By the way, I'm a little confused. First you were talking about Persons and now you are talking about Categories.
 

Mvkoe

macrumors regular
Original poster
Aug 4, 2008
103
3
Belgium
Nothing wrong with that.


Kinda done? What does that mean?



Have you considered using a drill-down approach rather than a drop-down?

By the way, I'm a little confused. First you were talking about Persons and now you are talking about Categories.

With kinda done i mean, i'm done with the things that are meant for me, so no iCloud, iPad, drawing Quartz stuff.

Yea sorry i'm confusing you, the persons thing was an example from the screenshot, and that not really has to do with categories that I want. I just want the drill-down menu ?

Correct me if i'm wrong. I'm thinking something like this:

Code:
didSelectRowAtIndex -> get label, search for that key string in my dictionary and get those value's -> Drill that down under the first categorie that it searched for?

How can i accomplish that drill-down ?
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Correct me if i'm wrong. I'm thinking something like this:

Code:
didSelectRowAtIndex -> get label, search for that key string in my dictionary and get those value's -> Drill that down under the first categorie that it searched for?

How can i accomplish that drill-down ?

You pretty much have the pseudo-code here. Now it's just a matter of translating that into actual code.

P.S. When you say "get label" be careful not to try to get the actual UILabel that is displaying the text in the cell. Instead, you'll want to retrieve this value from your datasource.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.