This is the situation:
I got the two image view on top of the view, and on the bottom is a container view (the one with the segmented control) that can be dragged upward.
Now, is there a way to add a parallax effect to the background image (the one with the blur) as I drag the container upward?
A I can see you are working on iOS 9 so you can use InterploationMotionEffect available from iOS 8. I have also created example for the same ParallaxEffectExample
Example is in swift & having two example set. First one as manual & second one using InterploationMotionEffect in UITableView.
Related
I want to create a control for ios 8+ where we have 3 images. In center image in big and left/right images are small.
I have to create some code in swift, using Stack Layout but it will not work in iOS 8 as it is available from ios 9. So need to change this. What should i use to keep images together (left and right bottom)?
Also another problem i have is, i need pan gesture on only big center image not on the small left and right image. So when i touch the big image i can move all three around the screen. Currently it if i touch any of 3 all moves.
Functions:
small left/right image: Act as button for running a swift function
middle image: on pan gesture drag all three around screen
You have 3 choices to create an image slider according to your requirement.
Using Scroll view (UIScrollView)
Using Collection view (UICollectionView)
Using Page Controller
Here are simple/basic logic, how and what you should use to achieve sliding image.
Using Scroll view (UIScrollView)
Add three images in scroll view with equal width
Set Height of middle image, according to your requirement (bigger than other)
Set width of any one image (probably middle) equal or around equivalent percentage (80% equal) to device screen using AutoLayout constraint.
Scroll view automatically scroll horizontally according to horizontal content size. You don't need to add Pan gesture.
You can also enable paging of scroll view.
Using Collection view (UICollectionView)
Add collection view with three (static) cells or single dynamic (You need to choose how do you want to update this feature in future. If you choose single dynamic cell then you can easily add more images in slider by adding its data into datasource variable, in future.)
Enable horizontal scroll only in collection view.
Update (make it bigger) Image height in data source method using index path for item (indexPath.item == 1).
Collection view have pan gesture also. You don't need to implement it.
You can enable pagination also.
Note: Set image/cell width equal to device screen or equivalent.
Using Page Controller
Here are nice reference tutorials, "How to use Page View Controller"
How To Create UIPageViewController Using Storyboard
How to Use UIPageViewController to Build Tutorial Screens
I do not recommend this option (Page view controller) but you have provided complete details about scope of your requirement (view controller level or it is simple child view slider), so this is an option to image slider also.
I am in the process of updating an old app from XCode 4.6 to 6.3 and have run into a difference in how my custom table view cells are rendered between iOS 6 and iOS 8 (well the change can be seen in iOS 7 as well).
Here are 2 screen shots from Xcode 4.6/iOS 6.1 simulator:
Here are the equivalent Xcode 6.3/iOS 8.1 simulator:
(As background, the Preferences screen is a grouped UITableView with 3 groups and 1 element per group. The Units screen is a single sectioned UITableView with 3 elements. And the "Note" on the Units image is just a plain view)
The difference I didn't expect (and don't like) is that in iOS 8, the custom table cells have expanded horizontally to cover the entire width of the screen, and have also lost their rounded corners.
I have been looking around to see if/how I can make the iOS 8.1 version look more like the 6.1 version, but so far have failed.
Is it possible to easily get back the layout I want? And if so, where should I be looking to make changes?
One possible approach is to set tableView.backgroundColor and your custom cell's contentView.backgroundColor to clearColor (it can be done via the interface builder as well). Then add a background view to your custom cell. You can give it rounded corners and add space around it.
This is what it looks like at runtime (the blue background belongs to the view behind a tableView):
This is more tricky though when we deal with a group of cells on your right screenshot. There the first cell has to have rounded corners at the top, the last one has to have rounded corners at the bottom, and the middle one shouldn't have rounded corners. I guess, it can be done (you could take indexPath into account when configuring the cell), but it takes a bit more work.
P.S. I'm sorry for the size of images. I don't know how to restrict it.
I'm new to iOS development and I'm just getting my way around Xcode 6 working with Swift, but I'm hitting small blocks here and there so please understand why question may be very basic.
My issue is I have a background image (UIImageView) which is placed within a View within a ViewController. All I want is to be able to drag and drop other type of objects like buttons or labels on top in the designer section. When I have the designer view I see these buttons and labels visible on top of the UIImageView, but when I run the project in the iPhone simulator all these objects disappear and I just see the background image (UIImageView). Is there something I'm missing here?
Thanks in advance.
You should read auto layout Apple document https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/
Basically its the way you describe position relatively, say you want to align button center on the UIImage, in this case you define 2 constraints vertical align and horizontal align.
I have a simple iOS app (running on iPad) that has only an UIWebView filling the full screen.
Now I added a new UIWebView(a lot smaller that the previous one) and let it sit on top of the first one.
Is there a way for me to be able to drag and drop the second UIWebView around on the first one?
Thanks a lot
You can use a UIPanGestureRecognizer to add drag capabilities to any view. Using it, you will be given the coordinates of the drag (you can set the view's frame with this), and are given a flag when pan has stopped (your drop).
Here's an example taken from the web: Working with UIGestureRecognizers
I'm just getting started with iOS development. I am trying to make a custom UITableViewCell for an iPad-only app.
I am using XCode 4.2 and the latest iOS 5 Beta.
When I'm trying to build my interface, I can't place an elements or make any elements wider than about half of the cell size that's displayed. In the screenshot attached, I want to place the "Name" label on the far right side and stretch the progress bar to the far right side as well. However, when I stretch the progress bar out any further, it just gets cut off.
I'm sure I'm missing something...any ideas?
If it is allowing you to stretch the progress bar the entire length and then cuts it off after you release it, then there is probably another object (i.e. custom button, image view, etc) on the right portion of your cell that is higher on the view stack.
Check in the Objects section of Interface Builder to see if that is the case. Then you can adjust accordingly.
I'll like to make a little guess here...does it have to do with the orientation of landscape/portrait? It looks like the cell is landscape but the view is only for portrait...
check every controller with background color property. set the different color for every one. Might be it's overlapped one view over second view.