I have a UIStackView consisting of clickable images. Whenever I tap one of them, a UIView appears on the right side of the stack, showing some more info about the clicked object. I'm trying to make a triangle, that will show user to what line in the stack does the UIView relate to, like shown in the picture:
I don't know how to do that though. My solution would be probably just make 10 UIImageViews (there's 10 lines in the stack) and whenever user taps an image,set it's corresponding UIImageView to a triangle and the rest to nil. That's clunky and dirty, though, is there any better solution? I'm sure there lots of ways to accomplish that, but what's the best one?
Related
I am experimenting a little bit witch apps programming.
How I can add a UIImage to a UITextField"?
Like Whats App or the most other Chat Apps.
I have search some time but doesn't find a solution, also i have tried to search in side of XCode with the auto complete but I have not found a function. So I hope you can help me.
The easiest way to add an image to a text field is to have a UIView that contains both UITextField and a UIImageView as subviews.
Next up, you can have a UIButton with both an image and text, and just set userInteractionEnabled to "NO" and it'll behave like a text view with an image next to it.
Now to get more complicated, if you want a chat-like text field that allows text (that you can type into) and images next to each other, you need to start thinking about custom subclasses. Other people have asked and have gotten answers for this same approach.
I'm developing a sudoku game in Objective C, in fact I kinda already finish it, I just have to adjust something of design and make a window view, somethings like that. But i'm still learning about iOS, so a I don't know what object view is the better to use in this case.
I'm using buttons to make the sudoku squares, but I wanna put in my game the possibility to make notes on the top of the squares with the possibilites that are available in that square, but the button view only have title propriety...
What view should I use instead of buttons?
Make a custom UIView subclass and initialize it with a UILabel on top and a UIButton covering all of it.
I would like to show a swipe-able 360 degree view of a product along a single axis by using multiple images stitched together to make it animated.
I'm new to iOS development, and am hoping to get pointed in the right direction to find libraries or built-in methods that could help me achieve this. I'm guessing this is a fairly common task, but I'm not even sure of the correct terminology. (I'm dabbling in RubyMotion as well, so that would be a bonus if it could work using that approach.)
how i might do it:
get an image showing up in the ui, running on the phone, base case :)
make a 'ThreeSixtyImageView' (subclass of UIView) that contains a big UIImageView.
keep an NSArray of UIImages in your ThreeSixtyImageView class; load up all your UIImages into that array.
keep a number that's an index into that array. when it changes, set the UIImageView image to the UIImage at that array index! hook up a button that increments the index (and show that image) to make sure that works.
add a UIPanGestureRecognizer to track touch state
when the pan gesture begins, remember which image you're on, and where they tapped (as an anchor point)
when the pan gesture updates, subtract the anchor and divide by something that feels nice to get 'how much user wants images to rotate'. this gives you a new image index value.
update your main UIImage with that new image index (into your array)
if there's a step here you don't understand, look in the examples included in the xcode/iOS documentation, and copy their code! the sample code is pretty good, and helped me a lot with editing XIB documents, and learning about GestureRecognizers.
good luck!
I have over 150 UIImageViews. I need them to behave like a large ballet. I also need to be able to dynamically choreograph them. Some spin, some duck, some jump (each currently a different UIImageView subclass).
I'm assuming I need to put them all into an NSDictionary, then grab the object based on a key and say "you spin", "you jump", "you duck". And do those moves in sync while the music is playing (no real music, but instead data coming in from an external source). And I have no idea what that music(data) will be until it arrives, and no one's heard the song before. I've setup a while (music){} loop with a large switch statement inside.
I'd like to place all the ballerina's on the view in the nib by hand so that they line up correctly with the subview. None of them change x,y. They might only change z, and maybe swap an image, fade opacity, etc (which I was calling spin, duck and jump). And there is no user interaction here, you're just in the audience.
I'm also assuming I'll need to use the UIView's beginAnimation, setAnimation, commitAnimation methods.
Am I on the right track? What's the best way to achieve this? Any optimizations I should consider?Apologies for all the analogies, it's the easiest way to explain what I'm trying to achieve.
I recommend you look at UICollectionView. There was a great WWDC session about it. I'm not exactly sure what you're trying to achieve, but with UICollectionView you can set up custom layouts and animate between different layouts automatically. So if your images have to move in sync, this might be a good option.
I'm developing an app that calculates poker odds, and now I'm facing some problems with the card selector.
This is a mockup of what I want.
I've found two ways to accomplish this. The first one is to use an entire UIImageView and detect touches, calculate where the touch has been generated, and set the corresponding value.
The second one is to use a lot of UIButtons, but in this case I get problems with the shape of the buttons.
Of course I can use a regular UIPickerView and so on but I think that the one I've designed is better.
if you have a UIButton with a background image that is shaped irregular. then that is the only point that the button can be pressed.
Change the type to custom and put your slices into buttons.
This has been my experience anyhow.
My buttons have to have a .01 alpha background to increase their pad size and people can push the button.
Hope that helps :)
After googled a little i've found https://github.com/ole/OBShapedButton .
it does anything what i need