How do I put a black opaque background behind a UI tableview? - ios

I have a textfield that, when text is entered, pops up into a tableview. The tableview only takes up the bottom half of the screen, and when the tableview is showing at least one option, I would like to make the rest of the screen an opaque black. (Note, I’m not talking about the color of the tableview itself, but adding a dark tint to the rest of the screen.) The area on top of the tableview also has other elements, so it’s not as simple as just changing the background color. Whenever I try to change it from where the tableview is controlled, I end up just changing the background of the tableview itself.
Here is a visual of something similar to what I’m trying to achieve:
https://images.app.goo.gl/npAE5ga2kCmQ8E2d7 .
Any help would be greatly appreciated!

1) Add your Selection options in new viewController names as optionPopUp(what ever you want).
2) set modalpresntationstyle of your new popUp as over current context with transition style as crossdisolve.
3) set background view color of new popUp viewcontroller with opacity(0.1 or 10%).
**4)**Present you popUp from source view controller i.e in didselectrowat method of uitableview delegate

Related

UITableView and UINavigationBar customization confusion. Any advice on how this was done?

Here is a part of the AirBnB app I would like built.
Here are the 3 questions that I'm in need of advice on.
How do i get a cell on a UITableView to act like the [ MORE FILTERS ] button? The button seems to act like a UITableView cell that always stay at the top. YET, it fades away just before going out of scope. Is this even a tableViewCell?
The view [ARRIVES | DEPARTS]. What view is this on a UITableView? When the tableView is scrolled all the way to the top it connects seamlessly with the [MORE FILTERS] button making it seem like its one view. But when the tableView starts scrolling, the [MORE FILTERS] button can be seen sliding over it as it fades away.
What is the [SHOW FILTERS] button? Is it a UINavigationItem titleView property or some separate view? As the table scrolls up it can be seen attaching itself to the UINavigationBar in a fade transition. At first i thought it was a just a UINavigationBarItem, but I do not know how to add items under the title of the bar. Any clarification on what this is or how can be accomplished?
I have already looked at Apple's Example on customized UINavigationBar, but it doesnt provide any clues to accomplish this. Any help appreciated
just like you did, when I came across an application like this one which has cool UI effects and animation, I would like to analyse and if possible try to do the same effect by myself, so that I could get innovations as well as knowledges.
Let's analyse it first, at the meantime you will probably find all the answers. I just drew a graph which shows the UI hierarchy of the screen, of course this hierarchy is based on my analysis, I cannot guarantee that the hierarchy is 100% correct.
I will do a bit of explanations here. From top to bottom:
1. The Navigation Bar(Red), just a opaque navigation bar, nothing special;
2. The Show Filters View(Purple) is a view which anchors to the bottom of the Navigation Bar(Red), and it is hided when the screen launches. Please note that this view is not a subview of Arrives & Departs View(Blue). It is added directly to the view controller's root view. Which means Purple and Blue are siblings;
3. The Arrives & Departs View(Blue), nothing special;
4. The More Filters View(Green), nothing special;
5. The Table View(Orange), nothing special;
So from my analysis, Purple, Blue, Green and Orange are all siblings.
Now let's move on to the fancy UI effects and animations. The trick here is you need to observe the change of the table view's contentOffset (I recommend to do it in the scroll view's delegate - scrollViewDidScroll), and move, hide or show the views accordingly. There are four stages:
1. The initial stage, like the graph above.
2. The Blue starts fading out, Green moves up as the finger moves, Orange increases its height. (Purple is still at the same position and hided, I just removed it from the graph in order to make it clearer);
Blue totally faded out, Green starts fading out and Purple starts fading in. Orange is still doing the same - increasing its height;
Green totally faded out, Purple totally faded in and Orange increases its height to fill the screen and then anchors to the bottom of Purple.
The [MORE FILTERS] button does appear to be a cell of the UITableView. Since it is a different type of cell than the other cells containing the UIImageView and the UILabels using a different identifier you can tell the cell to fade away with an animation. Try this link for more information.
The [ARRIVES | DEPARTS] seems to be its own view. I believe that this and the tableview are both part of a UIScrollView. This is the reason that it seamlessly disappears when the [MORE FILTERS] cell scrolls up towards it.
The [SHOW FILTERS] button could just be a part of the navigation bar. When the scrollView finishes scrolling the navigation bar can be extended. However, it is also possible that the button is in a view of its own and is hidden until the scrollview finishes scrolling. Either way should be possible but I would recommend putting it in its own view rather than attaching it to the navigation bar.

Create swipe to reveal buttons for iOS 7, using clear color for background

I followed this tutorial http://www.teehanlax.com/blog/reproducing-the-ios-7-mail-apps-interface/ to add more button beside delete button when swiping.
But the problem is the cell need to use clear color so the background image can be seen. But that approach used scrollview to display the content view and the buttons view of tableview cell. If the content view of the scrollview has any background color instead of clear color, it can hide the buttons so these buttons only display a part determined by our finger when swiping on the cell, using clear color for background makes these buttons show without the need to swipe from right to left on the cell.
So anyone can give me a suggestion to use the clear color to display the background image without revealing the under buttons?
You can use MGSwipeTableCell class for creating swipeable buttons with any colour you need. It will not interfere with the tableview cell color as well. It is very easy and quick to implement.
https://github.com/MortimerGoro/MGSwipeTableCell

Add a UIImageView to the back of NavigationBar (NOT background image)

I am trying to add a UIImageView to the back of a navigation bar.
The reason is because I want to create a UITableView whose navigation bar is actually a picture (with back button on the left) but I want the picture to scroll with the tableview and when the picture is fully scrolled out. The navigation bar is shown as per normal.
My solution to this problem:
Add a UIImageView to the top of the UITableView and make the navigation bar transparent. Set a contentOffset for the UITableView which is a subclass of UIScrollView so that when the view is presented, it looks like the picture is filling the navigation status bar.
Problem:
If I scroll up, instead of bouncing back, the transparent status bar is shown (with a color of the background as it is transparent).
Possible way to solve this new problem:
I was thinking of trying to limit the ScrollView size to get around with problem but failed.
So I feel is it possible to add the UIImageView to the "back" of the navigation bar so that it is there without any offset? Since that way, my life will be much easier.
Any suggestions on solving this or another new approach to get the same UI/effect?
Related question.
I would do this by adding either a table header or cell at the top of the table which contains your image.
Create the table view so that it extends all the way to the top of the screen. Extend Under Top Bars option. I have not done this with a UITableViewController but I have done this with a UITableView embedded inside a UIViewController's view with the top constraint set to 0 for the view rather than the top layout guide.
Now when you run this your table will fill the whole screen and the top header or cell will be at the top showing your picture.
When you scroll you can either use the UIScrollViewDelegate to detect the movement or implement tableView:didEndDisplayingCell:forRowAtIndexPath:
I'm not 100% sure when you want the navigation bar to go non clear. If its when the image goes off screen then didEndDisplayingCell should be good. If its when the cell bottom passed under the bottom of the navigation bar then scroll view might be your only option.
This will also bounce as you expect when you pull down and it should snap back to the top.
Hope this helps.

iPhone : How to make transparent XIB from which we can see previous view's uitableview

I want to make transparent xib view from which we can see previous view's uitableview.
I have one view which contain uitableview (listView.xib), from its one of navigation item, we can open one popup view or we can say that one another view(filterView.xib). I want to make this filterView.xib as transparent that we can see previous list of data - listView.xib.
its Works in IOS7 as well <= IOS7?
do it same thing and set the color of the view to clear color and change the alpha value to .5

PickerView layout - background too big

I have a UIPickerView which is the right size, except I want to background to be a lot smaller, so that the spinning part is bigger within the frame of the picker view.
Is this possible?
Thanks.
I am not sure if I get your question right, but there is no way to customize the UIPickerView controller. The only thing you can do is to overlay the UIPickerView with a custom image like it is shown at Custom background color of UIDatePicker and UIPickerView. There they simply created an image with transparent parts and put it on top of the control.

Resources