Currently, I have no idea what is the best approach to sending information from one button to another in Unity.
For example, if you select tripping, it may have 2 questions and answers, while Tripping Flow Check may have 3 questions and 3 answers. Tripping Shut-In may only have 1 question and 1 answer but the answer could be a jpg file, etc.
The image at the bottom is the current setup but don't know how to set it programmatically in Unity. Any recommendation?
If you want to do it programmatically you need to create a script where you reference different UI elements and change them when you want and as you want.
You can communicate easily between your UI elements, gameObjects and scripts using Events. Thanks to Unity Events you can do it from the inspector.
For instance this way you can disable/enable another object with your button:
This way you can change the UI Text.text
You can call methods from your scripts exactly the same way. Simply drag the object you want to interact with to On Click() tab, find the script you want in the drop down menu and select the method you want to invoke.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
apologies still relatively new to programming/swift. I've created a concept for a messaging app that has sliding buttons to filter/scroll messages but I can't work out the best way to achieve this functionality, so after some guidance on the best way to approach this.
I've considered:
Hacking a tab bar so it sits along the top (to switch between sent/received views etc)
Using a horizontal scroll view (not sure how to jump between the views using a button)
Using buttons to show and remove views programatically
I'm thinking of showing the individual message tiles using a collection view rather than a table view.
I'm also wondering if the design I've came up with is actually completely wrong as I can't seem to find any UI elements that behave in the way I expected (like the slider switches on my mock) and if I should completely rethink the layout. I'm open to that option if that's the case.
Any help/suggestions welcome!
You're asking a lot of questions - your post should focus on one task. Review How to Ask
But, to give you a couple ideas...
Take a look at UISegmentedControl. Here's an example only slightly customized:
A little searching will show you how to do that, or how to customize it even more (making the round-ends appear more like your mockup).
Below those, you could put two table views in a horizontal UIStackView. When you select a "Received / Sent" segment, animate the stack view to show the corresponding table view.
When you select a segment on the lower control, filter your data and reload the table view.
What you want to do, though, is just get started on it.
Begin with learning about UISegmentedControl and how to customize the appearance.
Then work on putting two views side-by-side and learn about animating their positions.
Then work on filtering your data source.
At each step along the way, if you run into a specific problem/question, come back and make a new post about that issue.
I'm working on a project and I've been asked to add a fairly detailed and nested menu system overtop pre-existing gameplay. I'm new to iphone programming in general, but have experience with other C languages on different platforms. I'm looking for an example of a good clean menu system architecture.
So far, I've gotten a little used to how the xib files interact with the code, but I still have a ways to go it seems. I have two UIViewControllers; lets call them UIViewControllerA and UIViewControllerB. I started with UIViewControllerA (the game's main view controller) and want to add UIViewControllerB as a menu to lay on top the game window. The only way I've found to get UIViewControllerB to render is to use it as a data member of UIViewControllerA and add it as a subview to UIViewControllerA.
This seems like a very unclean way to organize this system and introduces some bugs. IE - when I have UIViewControllerB showing, the touch events fall through to UIViewControllerA which I do not want.
Sorry this is long, but I'll get to the point. Does anyone have a good suggestion on how to create a clean and robust menu system? I feel as though I am way off the mark. I don't think I have enough experience to come up with a good system on this platform.
Thanks in advance!
EDIT:
I feel as perhaps I didn't specify that I'm seeking help for technical programming design rather than visual design. I'm seeking for a way to implement a state-machine type architecture for an iphone platform.
Check out this link - https://github.com/relikd/OGActionChooser
It's a nice-looking replacement for a UIActionSheet or UIAlertView - this could easily be customized to present a modal menu system.
A really easy way to have a clean menu page, simply take a picture of hardwood floor (or off the web) and add buttons. I would show an example but I need 10 points...
Take the pic, onto PS (photoshop) and add a box or square, add shadow and some cool special effects, upload it to xcode, but the buttons in the box.
I want to make a little in-app demo like Tapbots does in Convertbot. Maybe there is a better solution than mine?
make everything programmatically controlable
write a huge class with hundreds of performSelector:withObject:afterDelay: calls to control the whole app for the demo
The demo actually only does two things:
Simulate touches on controls (i.e. programmatically pressing buttons)
Show text message bubbles when appropriate to explain what is going on
How would you do it?
I don't think there is an easy way to accomplish this.
My suggestion would be to create a class that runs a script of actions for you. The script itself could be as simple as an NSArray of objects representing steps in the demo, each with values such as text for a callout bubble, an action/target pairing (for calling selectors), delay, and so forth. Use NSButton setHighlighted: to simulate button presses. Your class then runs through the array of steps to conduct the demo. You could code this directly, or construct the script at runtime from a YAML file (or other file format that you find easy to edit).
I would expect that investing some time in a mechanism like this will make your life a lot easier when it comes time to a) write and b) fine tune your demo, particularly down the road when you want to add features. You don't want to be managing a huge list of hardcoded calls. And you might even be able to re-use the demo-running code on other projects.
I am new to cocos2d, In that I want to create a button, by touching the same some events should be generated.
But I don't know how to make a button in the same. As well as want to save username also. But I am not able to create a text box even.
If any one know, kindly help to create both of the things.
If I am not wrong then there is not any method which will create button something like our normal iphone codes.
For cocos2d, making some functions which will work as Buttons, we are suppose to create CCMenuItem. The menu items are the best way to create button and it is easy to be managed.
After a long time I just come to know these things.
Have you looked through the Cocos2D documentation/forums and examples provided in the download package? There are many example apps which use some sort of menu/buttons.
I'm working on an iphone application (not web app) and I'd like to build a form asking a user to indicate a price range. Instead of using two text fields, I would prefer to use a double slider to set the minimum and the maximum price. I know that it is possible de use a simple slider (sound control for exemple) but i've never seen a double one. Can anyone help ?
This is not possible without creating a custom control. You'll need to inherit from UIControl or UIView and provide a custom drawRect method. You'll also need to respond to touch and drag events to update the state of the control. I have not done this myself, but I would be prepared for a fairly significant amount of work to get everything to respond and display as expected.
I'm curious as to why you need to have both values specified on a single slider? Why not use two sliders either side-by-side or stacked? It would not require any more input steps than a double slider, and would conform more to standard UI guidelines.
I think you can specify multiple thumbs for a single slider if you subclass UISlider, at least I vaguely remember that being possible in MacOSX. But Code Addict is right, you'll probably be better off using the standard controls - a double-thumbed slider seems like it'd be pretty difficult to deal with in the touchscreen environment.
I built such a control and added it to GitHub so feel free to have a look and if you like the control extend it and contribute.
GitHub page: http://github.com/doukasd/DoubleSlider
Blog post (showing a video of how it works): http://dev.doukasd.com/2010/08/double-slider/