iOS7 UITableViewCell background transparancy becomes opaque after a short pause - uitableview

I have a UITableView which is presented modally over a view. One of the cells in the table view is deliberately transparent so that the view underneath is visable. The issue is that is IOS 7.1 the cell starts off transparent and then immediately becomes opaque. Under iOS 8 the transparent cell technique works perfectly.
Qn. Has anyone seen this and come up with a valid work-around?
Things I've tried
Adjusting cell.backgroundColor
Adjusting cell.backgroundView
Adjusting tableView.backgroundColor
Adjusting tableView.backgroundView
Setting tableView.opaque = YES;
Making the adjustments in tableView:cellForRowAtIndexPath:
Making the adjustments in tableView:willDisplayCell:forRowAtIndexPath:
Using full transparencies
Using partial transparencies
Using transparent images
[[UITableViewCell appearance] setBackgroundColor:[UIColor clearColor]];
Essentially as soon as any transparency is introduced into the background it changes (after a slight pause to become opaque).
To re-iterate under iOS7 the transparency is there very briefly (less than a 1/2 sec) then it turns opaque.
Here is a vimeo of the effect: Link

Rather than focusing on the tableview and it's cells, look at the presenting (bottom) view controller. I believe (although I can't find it officially documented at the moment) that when you do a standard modal presentation of one view controller over another, the presenting view controller's view is removed from the view hierarchy after presentation. Working with a trivial test app, the presenting view controller's -viewWillDisappear: is called and logging the key window's -recursiveDescription show the presenting view controller's view has been removed.
However, if you use a custom transition, the presenting view controller's view is kept in place (presumably to allow for exactly this kind of transparency effect).
EDIT: I've put together a quick example app (here: https://github.com/sjc/ViewControllerTransitionExample) to 1) illustrate the difference in behaviour between standard and custom modal presentation, and 2) to show how a basic UINavigationController subclass can be built to solve this issue (the technique is normally just applied to straight UIViewController subclasses).
However... While this can be used to solve the issue in this case, it doesn't answer the 'what's going on here?' question, since the example doesn't reproduce exactly what you are seeing: the presenting view controller disappears on both iOS 7 and 8, and not just on 7, as described in the original question. Oh well.

try to change to table cell from the Appearance system in your AppDelegate
[[UITableViewCell appearance] setBackgroundColor:[UIColor clearColor]];

This won't work on iOS 7 because modal views are always opaque. On iOS 8 they can be transparent.
You will have to find another solution on iOS 7.
That is seems to work for 1/2 of a second is because modal views aren't opaque during transition.

Related

UISearchController's UISearchBar shifts incorrectly and jumps when UITableView is scrolled

In the video, it's a little difficult to see what's going on, so I'll try to explain it.
https://youtu.be/yOrCJB9yZlg
I have UIViewController with UITableView inside its root view. Binded via Autolayout (there is no difference how it's binded: to SuperView or to SafeArea).
SearchBar added like this:
let search = UISearchController(searchResultsController: nil)
self.navigationItem.searchController = search
When I slowly scroll table, the transition between large navbar and compact navbar, and then animation of showing in and out of searchBar is too fast. Searchbar jumping in/out of navbar instead of smoothly opened/closed; navbar transitioning is jumping between two states, large and compact, without smoothly passes through the middle half-opened state while you slowly moving your finger on screen, like in system apps (Mail, Phone, Messages, Contacts etc).
I made the example from an empty project to demonstrate the issue; there isn't any changes to navigation bar logic, or any logic at all. Just two new VC's and this odd behaviour.
If i create xCode's "Master-Details" project example and add UISearchController to it, it will work properly. I assume its because they used UITableViewController instead of UIViewController + UITableView inside.
What the reason of this behaviour and how to fix it?
I had the same problem with the search controller transition and tableview.
like this its flickering or tableview was jumping. The search controller was on the navigation item.
The key solution is to remove safe area guide from your view controller and assign top bottom left right constraints to your tableview. It will be smooth like this
What you have done is correct. Did you try running your code in a device? Feels more like a glitch in the simulator. I tried what you tried and it works fine for me in the device. Whereas the glitch occurs in simulator.
Refer to this article. They have explained step by step process.
This is a known problem and your code seems fine. This problem was already discussed here.
Problem appears when you're using UIScrollView or its subclasses with large navigation titles. It doesn't work. Problem disappears when you use UICollectionViewController or UITableViewController instead.

Changing the popovercontroller background colour of UITabBarController

I am calling a UITabBarController and displaying it as a popover, however when the popover is displayed, at each corner there is a little white edge (the views within have a coloured background).
In any other UIPopoverController I would set the class of the view to a .m file and then use the following code in the viewDidLoad method:
self.popoverPresentationController.backgroundColor = [UIColor blackColor];
However I am unable to set a custom class to a UITabViewController and so am unable to do this.
I have attempted to set the above code in the individual tabs once they load however this has no impact as they are sub-views of the UITabViewController.
Has anyone got a solution for this? I have searched all over for an answer and it is eluding me.

Why Will UITableView Background Color Not Change? (Xcode 7 beta 4)

I am working in Interface Builder of Xcode 7 (beta 4) and I am modally presenting a UIViewController that contains a UITableView. The background of my view controller's view is clear because I am presenting it over the current context, and it contains a UIVisualEffectView with a dark blur so that the initial UIViewController's content is slightly visible from underneath.
I am trying to get my table view to have a clear background with clear backgrounds on all of the cells so that the blur view is visible throughout the table, which I have successfully accomplished in Xcode 6. However, when trying to do the same exact thing in Xcode 7 (beta 4), this is what I am left with:
The only property of the table view and cells that I have changed in Interface Builder is backgroundColor.
Does anyone have any idea what the problem may be?
I have found exactly the same bug. I can fix it by adding the below code into the viewDidLoad of the VC, but I am not going to go through every VC and do this until this is confirmed as a bug or new behaviour. Seems pointless to add code that doesn't need to be there if a bug fix is due. But for now:
[self.yourTableView setBackgroundColor:[UIColor redColor]]; // XCode 7.0b4 bug. Not picking up from Storyboard
[self.yourTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; // XCode 7.0b4 bug. Not picking up from Storyboard
Hope this helps.
A work around that seems to be work for me is to set the background to .clearColor() programmatically instead of in the storyboard

iOS 7 UINavigationController Push animation shadow

With iOS 7 a new push animation was created, which slides the pushed view controller on top of the hierarchy. But when the animation happens, iOS apparently does two things to modify the design of the top view controller:
A shadow is added:
And a light overlay over the bottom view controller:
In most applications this is not a problem. But, I am currently working on an application with pixel perfect design and I use view controllers with clear background. But this functionality remains the same, and the light overlay appears over the view controller. Because the background is a white gradient, this light overlay (on screenshot 2) is very visible and when the animation completes, it is removed without animation, which makes it very noticeable and annoying.
I am aware I can create custom animations and transitions, but I am wondering:
Is there any way to remove (or modify) this light overlay and shadow, without having to create custom transitions?
Thank you for your help.
It's not the most elegant solution, but I've seen people use UIImage animations to show what they want shown. So, you could:
Screenshot the incoming UIViewController
Animate the arrival of a UIImageView
Call pushViewController:animated:, passing NO for animated:
Remove the UIImageView
Again, a bit of a hack, but maybe it's the best solution for your scenario.
Try this proxy
[[UIImageView appearanceWhenContainedIn:NSClassFromString(#"_UIParallaxDimmingView"), nil] setAlpha:0.0f];
I don't know if Apple allows this or not because it uses a private API. Will update when app submitted.

UINavigationController with custom vertical button bar

I need to implement a navigation based app with a custom made button bar that stays on the vertical size of the screen, similar to Reeder iPad app (see Reeder screenshot).
What is the best way to achieve that result? I thought about adding the bar as a subview of the UINavigationController and calling its methods (like pushViewController:animated:) via the parentViewController reference from my button bar view controller, but it seems a bit convoluted.
Might work, but dangerous: set a transform on the CALayer object of the UINavigationBar. A transform that rotates the bar by "-1 * M_PI_2" would be almost right, you might need to translate it a few pixels too, to get the position correct.
Definitely works, but more effort: render a custom navbar, implement the delegate protocol from UINavigationController, and listen to the nav changing, and implement your own animations inside the callbacks.
(I've done the latter method to provide custom UINavigationBars - it works fine)
The only caveat with latter method is that your animations might pause / delay because by default they wait for each other to finish. If you look at the UIView animations, there's a setting that says "play immediately, even if other animations are in progress", and you might need to set that to YES.

Resources