Help with Xcode [how can i do so a button sends me to a specific tab]

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
Hey, i made an app in xcode with a bunch of tabs and theres questions, the correct answers sends you to the next question (selectnexttabview) and wrong sends you to the first (selectfirsttabview) But how can do so a button sends me to a specific tab, lets say i have 28 tabs, I'm on tab 1 and want to have a button that sends me to tab 26. How do i do that?

Thanks!

lol.
 
Last edited:

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
is it selecttbaviewfromsender? If anyone knows could you please help me.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,559
3,966
First off, don't bump topics (you'll certainly need to wait more than 70 minutes sometimes.) If you have more to say, edit your latest post.

Second, you shouldn't be designing your UI this way. If you're designing an interface with so many tabs (or views in general, really) or a hidden tab bar, you're probably designing it wrong.

I'd be willing to bet that you have several views that you've copied and pasted and that you manually entered questions and answers in them. You'll be hard wiring the buttons to always trigger that the user picked right or wrong.

I suggest that you instead take a moment to learn how to do this properly. Have a single view that all of your questions share and instead programmatically change the contents of the text. Programmatically change which buttons indicate the wrong or right answer.
 

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
First off, don't bump topics (you'll certainly need to wait more than 70 minutes sometimes.) If you have more to say, edit your latest post.

Second, you shouldn't be designing your UI this way. If you're designing an interface with so many tabs (or views in general, really) or a hidden tab bar, you're probably designing it wrong.

I'd be willing to bet that you have several views that you've copied and pasted and that you manually entered questions and answers in them. You'll be hard wiring the buttons to always trigger that the user picked right or wrong.

I suggest that you instead take a moment to learn how to do this properly. Have a single view that all of your questions share and instead programmatically change the contents of the text. Programmatically change which buttons indicate the wrong or right answer.
Um so that means you can't do what i asked? Because i want a new view without having a new window..
And also i have already done that, don't mean to sound rude, but i don't really care if thats not "the way" you should do it, it works, and its fun for me.
 
Last edited:

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,559
3,966
Um so that means you can't do what i asked? Because i want a new view without having a new window..
And also i have already done that, don't mean to sound rude, but i don't really care if thats not "the way" you should do it, it works, and its fun for me.
I didn't say you couldn't do what you asked - I don't know whether it's possible or not. Although thinking back, I believe you have to give your tabs names and use those names to programmatically select them, if you want to stick with Apple's tab view class and only use public methods.

I didn't tell you to make a new view or a new window.

And I don't mean to sound rude, but I wouldn't hire you if I knew you designed stuff this way, and in fact I'd probably fire you if I discovered it if you somehow slipped through the interview process. This isn't a matter of opinion - there's not a single experienced programmer that will tell you your design is a good one. Setting the bar as "it works" is awfully low and apethetic to the future people who want to read, understand, maintain, debug, and update your project.
 

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
I didn't say you couldn't do what you asked - I don't know whether it's possible or not. Although thinking back, I believe you have to give your tabs names and use those names to programmatically select them, if you want to stick with Apple's tab view class and only use public methods.

I didn't tell you to make a new view or a new window.

And I don't mean to sound rude, but I wouldn't hire you if I knew you designed stuff this way, and in fact I'd probably fire you if I discovered it if you somehow slipped through the interview process. This isn't a matter of opinion - there's not a single experienced programmer that will tell you your design is a good one. Setting the bar as "it works" is awfully low and apethetic to the future people who want to read, understand, maintain, debug, and update your project.

But it doesn't matter if you wouldn't hire me or not, its a private project, no one else than me is going to use it.
 

gnasher729

macrumors P6
Nov 25, 2005
16,509
3,102
But it doesn't matter if you wouldn't hire me or not, its a private project, no one else than me is going to use it.
If ArtOfWarfare wouldn't hire you because of your design, it means that you will also run into trouble with your own home project. The old joke is: Programmers know only three numbers: None, one, and many. 28 is not on that list.

Oh well, it has to be said: Looks like ArtOfWarfare doesn't like Intelligent Design :D
 

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
If ArtOfWarfare wouldn't hire you because of your design, it means that you will also run into trouble with your own home project. The old joke is: Programmers know only three numbers: None, one, and many. 28 is not on that list.

Oh well, it has to be said: Looks like ArtOfWarfare doesn't like Intelligent Design :D

So far i have not run into any problems, why do you just go off topic, i though people were nice on these forums, but guess i was wrong...
 

Red Menace

macrumors 6502
May 29, 2011
380
45
Littleton, Colorado, USA
You most likely haven't had any problems because you don't have that many questions, but expand to a couple of hundred and you will see what they are talking about (if you are really up to 28 tab views you should already see what they are talking about). The solution would probably be the same either way - you have an array (or dictionary) of questions/answers, or an array of tabViews, so just index into the array for the desired item(s). Take a look at some of the other methods in the NSTabView Class Reference, for example selectTabViewItem:, selectTabViewItemAtIndex:, etc.
 

lee1210

macrumors 68040
Jan 10, 2005
3,180
1
Dallas, TX
People are nice here.

So nice, they are trying to teach you to fish rather than giving you one.

The basic answer you were given was "I don't know, because that's a suboptimal approach. Here's a more standard one".

"And also i have already done that, don't mean to sound rude, but i don't really care if thats not "the way" you should do it, it works, and its fun for me."

Was your reply. OK. Well, you've decided you want to strike out on your own, doing something in a strange way. You assert "it works", but you're having trouble with the approach. It's great to blaze your own path, but it's a bit odd to get upset when folks don't know where to go next when you've gotten yourself stranded.

I am positive what you want to do is possible, but it would be much easier to replace contents of a single view. If you took that approach, others would be able to help you more readily because it's a standard pattern.

I'm unclear why this thread got as heated as it did. It's really common for people to give a good answer here that doesn't exactly fit the question.

-Lee
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,559
3,966
The old joke is: Programmers know only three numbers: None, one, and many.
Ha, I've not heard that one before. I wonder if it's possible to come up with style rules to effectively enforce the idea behind that joke...

Looks like ArtOfWarfare doesn't like Intelligent Design :D
I don't understand what you're saying. Am I being insulted? Is there something I need to learn about?
 

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
The OPs username is Intelligent and his design is abrasive.
Aw come on, don't insult me, please don't talk off topic, and if its so bad to have different views how can i have a view change on a button without using a new tab view?
 

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
Check out the NSButton Class Reference. You can easily set the button title and image (and just about any other property) programmatically, unless this is the reason for using tab views.
Thats not what I'm referring to lets say this smiley is a window [:)] and when i click it i want it to change to this [:):)] and the only way i have found a way to do that is multiple views.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,559
3,966
Thats not what I'm referring to lets say this smiley is a window [:)] and when i click it i want it to change to this [:):)] and the only way i have found a way to do that is multiple views.
Then have two smilies in your view. Have the first one always visible and don't show the second one visible until after the button is clicked.

For your program, you should be programmatically changing the contents of your text field that presents your questions and the contents of the buttons that present your answers. You'll need to also keep track of which button holds the right answer (I suggest shuffling the options around so people can't just memorize where the right answers are). Feel free to ask for more help if you need it.
 

xStep

macrumors 68010
Jan 28, 2003
2,001
97
Less lost in L.A.
Hey, i made an app in xcode with a bunch of tabs and theres questions, the correct answers sends you to the next question (selectnexttabview) and wrong sends you to the first (selectfirsttabview) But how can do so a button sends me to a specific tab, lets say i have 28 tabs, I'm on tab 1 and want to have a button that sends me to tab 26. How do i do that?
I've read all of your posts in this thread and am not sure what you really want. Do you want to be able to randomly select another tab, or do you want to specifically change from specifically one tab to just one other tab, such as tab 1 to 26 out of the 28 tabs?


Aw come on, don't insult me, please don't talk off topic, and if its so bad to have different views how can i have a view change on a button without using a new tab view?
I'm not insulting you. I was reflecting the view others have, that I agree with, and was responding to ArtOfWarfare's questions.


Thats not what I'm referring to lets say this smiley is a window [:)] and when i click it i want it to change to this [:):)] and the only way i have found a way to do that is multiple views.
This doesn't explain what you really want any better than your original post.

Come up with a very clear explanation and post images if it can help others understand your needs.


As others have mentioned, you can use one view, lay down the labels or text values you need onto that view, and update them for each Q&A set. You'd index the Q&As and access them as needed to place them into the labels. As mentioned, if these are multiple choice, then each time you display them, you should randomize the order in which they display.
 

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
I've read all of your posts in this thread and am not sure what you really want. Do you want to be able to randomly select another tab, or do you want to specifically change from specifically one tab to just one other tab, such as tab 1 to 26 out of the 28 tabs?




I'm not insulting you. I was reflecting the view others have, that I agree with, and was responding to ArtOfWarfare's questions.




This doesn't explain what you really want any better than your original post.

Come up with a very clear explanation and post images if it can help others understand your needs.


As others have mentioned, you can use one view, lay down the labels or text values you need onto that view, and update them for each Q&A set. You'd index the Q&As and access them as needed to place them into the labels. As mentioned, if these are multiple choice, then each time you display them, you should randomize the order in which they display.
I want to be able to select a specific tab, lets say tab 27 when i am on tab 1 2 3 whatever.
I just want a button to send me to a tab, i can't explain it more specifically than that, I've been trying for 2 months now with no success.
 
Last edited:

Dookieman

macrumors 6502
Oct 12, 2009
390
67
(I'm assuming English is not your primary language?)

We need the following to effectively help you.

-What language are you using?
-Applescript or Objective-C?
-Can you post a screen shot of your compiled app?
-Can you post a screen shot of your code so we can see what you have so far and where we can help?

We need to these to most effectively help you with your problem.

Others have given advice on how to improve the over performance and layout of your app. You claim you don't care and want to do it your way. Why do you want to learn how to do things the wrong way?

Also, stating "Help in Xcode" is very vague. Xcode is an IDE.

Xcode itself can be very daunting since it is quite complex, and understanding how to use it and make effective code would be a better question for "Help in Xcode".
 
Last edited:

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
(I'm assuming English is not your primary language?)

We need the following to effectively help you.

-What language are you using?
-Applescript or Objective-C?
-Can you post a screen shot of your compiled app?
-Can you post a screen shot of your code so we can see what you have so far and where we can help?

We need to these to most effectively help you with your problem.

Others have given advice on how to improve the over performance and layout of your app. You claim you don't care and want to do it your way. Why do you want to learn how to do things the wrong way?

Also, stating "Help in Xcode" is very vague. Xcode is an IDE.

Xcode itself can be very daunting since it is quite complex, and understanding how to use it and make effective code would be a better question for "Help in Xcode".
You are the only one that has said something about "help in Xcode".
However, i dont see how it's the wrong way, they just said what i could do, not how to do it.
In this app i am using objective-C.
I have not done any coding yet i just want to know how to click a button so that i can get to a tab. Linking a button to a tab.
 

Red Menace

macrumors 6502
May 29, 2011
380
45
Littleton, Colorado, USA
Unless you want a bunch of buttons, one plan would be to use a button to programmatically go to a particular tab by using something like NSTabView's selectTabViewItemAtIndex, which has already been mentioned.
 

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
924
2
Unless you want a bunch of buttons, one plan would be to use a button to programmatically go to a particular tab by using something like NSTabView's selectTabViewItemAtIndex, which has already been mentioned.
I want to have a bunch of buttons.