I would like to make two UIViews. One of them will be fixed in the background with less opacity and the other above will be scrollable. Can I do this?
Yes you can do that. Its quite simple to do that implementation. You create 2 UIView's in the NIB file, one above the other ( in an hierarchy point of view). YOu can set the opacity of the one above, so you can see the one behind. Then, just drop an UIScrollView in the front one. If you need more help with specifics just reply. :)
Related
Is there a way to find all UIView items positioned over a given point? I have a Swift project with a custom keyboard. The footer has four buttons and the taps are not working. I think perhaps there's an overlapping view which is higher in the Z-order so it blocks the taps, but transparent so I can't see it.
I didn't write it so I'm not sure about what view might be doing this. If I can pick a point and find all views that cover that point then I could use reflection to find out which of our extensions of UIView it might be.
Thanks
Mike
I'm using storyboard.
And I have a toolbar with toolbarButtonItems separated by flexible spaces.
I want labels for each buttons. So I put labels in storyboard, but when rotating the device to landscape, labels are not aligned with buttons.
How can I solve this?
Any suggestions are welcome.
Kindest regards,
Well good sir, like many before you, you're presented with a two options.
Use Auto-Layout's Constraint system to describe what you want.
Use -layoutSubviews, and manually reposition the views in your ViewController.
The Second document on is on how to subclass UIView's in general. Defiantly worth the read. Since you said you're a beginner, it's probably best to use Auto-Layout, so you should probably start there.
I've been looking around here and seeing lots of questions that seem related, but I haven't found anything that's exactly what I need.
I have three UIViews that are animating inside a custom viewController. I want there to be a static background inside the viewController that is only revealed within the clipping bounds of the UIViews.
It's kind of like spotlights on a prison yard: the background should stay in one place, but as the spotlights move you can see different parts of it. Except that I don't need circles, regular old UIView frames are fine.
For instance, it seems like what I need is in the answer to this question: How to achieve dynamic UIView masking?
...the answerer provides a link to a page that shows how to statically mask an image, and then the answerer says "But personally I think i would make 2 UIImage views and crop the content of the draggable UIView"--without any info on how to do that.
How do you do that?
Perhaps it's something with Xcode 4.5+ or iOS 6 that makes my research fruitless so far, but...
Apple's own advice hasn't worked for me. I set the contentSize to something different, and it causes no changes.
I found this wasn't unique to me, but the answer in that question 1.) does not inform me about the problem and 2.) I'm left wondering if it's really impossible to create a simple, non-inheriting example of UIScrollView. Thus, this question.
A better answer's code was tried within viewDidLoad and viewDidAppear, but to no avail.
So what gives? Is it possible to create a simple, image-filled view that allows scrolling? Say... something as easy as this basic project I set up on github -- but working?
Create and initialize a UIScrollView
Add it as subview to the view of viewcontroller
Make an array of image names
In a loop create UIImageView and add the images and add imageviews into scrollview considering the width of images, set the frame of imageviews
Number of images is known and the width it consumes can be calulated from the loop itself use it to set the contentSize of the scrollview
I'm short on RAM most of the time.
Perhaps you should rethink your app logic if you are piling up views like that. However have you tried setting the bottom views hidden property to YES?
If its not visible, remove it from the superview, if you are so tight on RAM.
However, I can't see why you are in a state with multiple seemingly-memory-heavy stacked views in the first place.