Hey guys.
Can anyone tell me a simple way on how to get a slider value from view A into view B. Please provide some code. Thanks to anyone who attempts to answer my question!
Hey guys.
Can anyone tell me a simple way on how to get a slider value from view A into view B. Please provide some code. Thanks to anyone who attempts to answer my question!
Does View B launch view A? (Modally or push onto stack?)
Hey, thanks so much for your reply. So up to now i have had 2 different .h view controllers with 2 xib's. I used the info button to switch between them. In the second view i want to have volume control sliders that will set the volume of the music in the first view. So i would i have do this data sharing thing which my brain wont get.Now I have read about subviews.Would creating a subview solve the problem? And if so, how do i create a subview?
Thanks again.
Hey, thanks so much for your reply. So up to now i have had 2 different .h view controllers with 2 xib's. I used the info button to switch between them. In the second view i want to have volume control sliders that will set the volume of the music in the first view. So i would i have do this data sharing thing which my brain wont get.Now I have read about subviews.Would creating a subview solve the problem? And if so, how do i create a subview?
Thanks again.
Well... How are you bringing the second view up? Modally? Animated transition?
When the info button is clicked you bring up that next view. Make the view that HAS the info button the delegate of the next one. When the slider changes call the procedure back in the first view and change the volume... You can pass the slider value back in that procedure.. (If you look at the code posted it should make sense...)
Overkill m8. So the first code u posted sets View A as the delegate of View B. Then the next code you posted is how u callback the value while in View A from View B? Sorry im a bloody beginner and thanks a ton for your patience.
Now go back and forth... You will see that the procedure in Main gets called when FlipSide Done is clicked... Pass what ever you want to that procedure.
You can also pass things to FlipSide Like this:
Code:
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
controller.delegate = self;
controller.YvesFlipSideVariable = "@Sweet" //Needs to be declared in Flip and I know the Capital Y is not convention... Making a point!
This is a recommend approach by Apple. (see my links in previous post reference)
LOL A Kiwi? as in the fruit? I don't know...Im on my 15th attempt right now, so yes i'm actually beginning to wonder myself if i am in fact a kiwi. Wanna eat me-----my life is not worth living anymore ?
LOL A Kiwi? as in the fruit? I don't know...Im on my 15th attempt right now, so yes i'm actually beginning to wonder myself if i am in fact a kiwi. Wanna eat me-----my life is not worth living anymore ?
Cracking Up again... No a New Zealander. (m8, Bloody - Hadn't heard that much since my Kiwi friends)
That should work. I have found that NSUserDefaults is very convenient for data persistence throughout an application.
NOTE: If for some reason you decide to save your slider value as an Integer instead of a string, make sure to use 'integerForKey' instead of 'stringForKey'. Also, make sure to release those new strings you allocate - be a good memory citizen.
That should work. I have found that NSUserDefaults is very convenient for data persistence throughout an application.
NOTE: If for some reason you decide to save your slider value as an Integer instead of a string, make sure to use 'integerForKey' instead of 'stringForKey'. Also, make sure to release those new strings you allocate - be a good memory citizen.
Thnx alot.
So i put the NSUserDefaults in my IBAction for the slider and it gives me error message my not respond to set object stringforkey and when i interact with the slider the app crashes.
please help me and thnx again.
Master Ladd dont worry i am still loyal to you, but i will have attempt stoicejustices wise approach to this problem.
LOL... No worries (<<< Kiwi Friends remember?) I don't have all the answers.
But
Code:
in whatever view of your application that you want to call that variable back
Means your Volume slider won't register your volume changes until you return to the view. Based on your OP you want that to happen kinda "live"... Right?
Call the delegate method as it changes and it will/can. Maybe add a little delay to smooth it out... Dunno
And the below is from other code... But you should get the jist.
LOL... No worries (<<< Kiwi Friends remember?) I don't have all the answers.
But
Code:
in whatever view of your application that you want to call that variable back
Means your Volume slider won't register your volume changes until you return to the view. Based on your OP you want that to happen kinda "live"... Right?
Call the delegate method as it changes and it will/can. Maybe add a little delay to smooth it out... Dunno
Ok so from the beginning i am making a drum app and when i click the info button it changes views and then from that view i want to control the volume for each drum. It dose not have to be activated until i change view again. Also i would like it to stay that way so next time when i change view the slider are where i left them.
Ok so if want me to post code i don't really have any....My flipsideview is still empty. All i did so far was create a practice app and i connected an IBOutlet to a slider and an IBAction changevalue. So i would be incredibly thankful if you could baby-feed me what i have to do.
to the saving code and then loads it in the 'viewDidLoad' portion of whatever view he is transferring it to.
But viewDidLoad will only be called once. viewWillAppear will be called every time the view is shown. (in most instances... There are exceptions)
As I said. He wants a slider to control volume. That means he needs the changes sent to the "calling" view pretty much in real time. You can't wait for viewWillAppear. (and it won't be called in all circumstances)
Try both approaches...
Multiple options are always good. And it is nice that people contribute to help.
The delegate method is what Apple is pushing. And it works. Beautifully.