I am using swift3 in xcode.
I have made an application with 10 sliders which I rotate to vertical using:
slider1outlet.transform = CGAffineTransform.init( rotationAngle: CGFloat(-Double.pi / 2))
Same goes for slider 2 through 10 this works without a problem,
but I want to add constraints so they go maximum height and are evenly distributed across the width of the screen, and they adapt when I rotate my screen.
This doesn't seem to work, the constraint seems to turn with the slider and I don't want that.
I have made screenshots (with only 3 sliders just for demo purposes)
the first slider has a red background to show what I mean, here is the screenshot of the application without rotating the sliders:
With the rotating sliders (only 1st slider has red background)
I had exactly the same problem, and it took me forever to figure out. I finally ended up writing my own class exactly for this: VerticalSlider.
Simply make new UISliders in your storyboard and set their classes to VerticalSlider.
It took me countless hours of trial and error in one of my projects to make that, so I'm glad I can finally help somebody else :D
Related
I have made an application with 10 sliders which i rotate to vertical using:
slider1outlet.transform = CGAffineTransform.init( rotationAngle: CGFloat(-Double.pi / 2))
same for slider 2 thru 10
this works whitout a problem, but i want to add constraints so they go maximum height and are evenly distributed across the width of the screen, and they adapt when i rotate my screen.
this doesn't seem to work, the constraint seems to turn with the slider and i dont want that.
i have made screenshots (with only 3 sliders just for demo purposes)
the first slider has a red background to show what i mean, here is the screenshot of the application whitout rotating the sliders:
with the rotating sliders (only 1st slider has red background):
Been trying to get the slider to work as a banner of sorts. It is indeed working, mostly, but I keep bumping heads with this odd bug. The blue background takes the place of about half the image whenever it is moving, this can be due to a transition but also when you slide the image around slowly. See the picture below for more details.
The things I have done to the slider are simple, I've removed the share buttons, lowered both the arrows and the dots and finally I've added the two Icons seen above as circles on a white square. Please help!
I solved my problem by using another plugin. Others in my situation might want to try http://responsiveslides.com for another plugin.
I'm having some issues with the constraints in my app. Here is how it looks on the iPhone 4 (that's how i want it to look, and how i usually setup my interface, is this the proper approach or not?)
Now, when i switch to the iPhone 5 screen it looks like this
and as you can see, the blue dots (which is UIButtons) are not placed where i want them to be. I made my constraints rely solely on the right side of the view (since that is the one re-sizing, i found that in order for you'r views to align themselves accordingly, it doesn't help to align them to the left side). I don't really know how to fix this. I am finding this new iPhone screen to be a real pain in the arse. Any good advice on how to work with this new screen without a lot of headache would be appreciated :)
Thanks on advance
It looks to me like the are still the same distance from the right side of your view, as you said you set them to be, while the background has stretched to fit the new size. I suspect it's actually the background that isn't doing what you want it to do (keep the same aspect ratio and show more stuff on the left), or try keeping the buttons relating to left and right to stay aligned with the stretched background image.
I've implemented autoresizing mask in all my the views of my project very successfully. However in the last one, which is the settings and there are a lot of sliders inside tableCells, it seems it doesn't work too well.:
I'm sure I've implemented the thing right
slide.autoresizingMask=UIViewAutoresingFlexibleWidth
for the sliders and flexible left margin for the labels.
I've also implemented table reload when the rotation takes place.
The cells are being reused ok, or at least in portrait mode they work, but when I rotate and go back I got what you see in the picture.
Any ideas on what am I missing?
Thansk in advance!
I have a graphic that is 3 times the width of an iphone landscape view.
I am trying to auto scroll it so that it appears that it is moving sideways, without using the touchscreen scrolling method.
My aim is to maybe have a button you can press and it moves it left or right across the screen like an animation.
I can deal with everything else but am having trouble finding a solution.
Any example code would be appreciated or even any info on whether it is possible or not.
Thanks. Dave
You can wrap a UIView in an animation block. The animation sweeps the origin value in its frame property from one point to another, over a set period of time.