Keyboard causes UICollectionView Cells loading bug - ios

I got a funny question: "Can someone explain this behaviour?"
Click here to view .gif (I'm not allowed to post pictures yet)
Explanation: When I click on the search bar a new ViewController is being presented (the one you see in the gif). There the keyboard is immediately popping up. When I now dismiss the keyboard by scrolling down it seems like the cells that were behind the keyboard re-render or were not loaded yet... I have no clue where to search for this, so I spared the hassle of posting unnecessary code.
Thanks! :-)

Nothing is wrong with the gif. UITableView cells are created and reused when necessary. That is when they become visible or invisible. Since you changed the view controller with the keyboard popped up, only visible cells are created. The ones behind the keyboard are not initialized yet.

Related

iOS Button not fully rendered after push transition

I have a view controller that when a subclass UIButton is tapped, it pushes another view controller. The problem is that I have another button of the same subclass on the newly presented view controller but when it appears it's cut off.
This problem solves itself when I tap a keyboard key and if I tap "Debug View Hierarchy" it appears fully drawn in Xcode and when I exit debugging it's fully drawn.
Here's an example of the problem in an iPhone XS Max iOS 12.1 and Swift 4.2 (I've covered with a red rectangle some text fields since they have user details but they're are subclasses of UITextField and the card view is a child view controller with a UICollectionView):
This is what I get
This is what I expect
I have tried putting setNeedsDisplay and layoutIfNeeded for the button and its superview inside viewDidAppear and viewWillAppear but I haven't been able to determine what's happening and how to solve it. I would really appreciate if someone could help me. Thank you!
I think this is not a rendering issue and its another view on top of the button. Try more investigating in view debugger
Then see what it is. (check other UIWindows)
I guess it's keyboard suggestion's view. or some footer view or etc.
It looks like the keyboard’s ´inputAccessoryView´ is getting in the way.
You can try disabling it.

Do you have to put the UISearchBar in a UITableView?

I would like to use a UISearchBar and put it towards the bottom of a screen in order to search for available names through an API call. I want to have this SearchBar as part of a sign up form. However, when I put the SearchBar on the screen where I would like through the Storyboard, it does not show up when I run the app on the simulator. When I looked up this issue, everyone is putting the searchbar in a tableview. Am I not using the correct UI element for my cause?
The reason your search bar is not on the screen is probably because you didn't set constraint correctly or it was hidden or covered by some other view.
And for your second half of the question, I myself never put a search bar on a UITableView itself. Some apps put a search bar on the first cell of a table view but you have to scroll to make it show up. I myself always prefer to put it on the navigation controller on the top of the screen so that it will always be there and ready for user to search anything.

Touching an area of screen dismisses view controller

I've never seen a problem like this until now. When I first updated my app, this problem did not exist. It was fine. Since then there've been a couple of iOS updates, so it's possible this is where the problem began.
I basically have a few view controllers that proceed like a wizard from one step to the next, by either clicking back/cancel button or the next button.
There's a textView covering the main area.
Normally by touching inside the textView it would begin editing.
On this viewcontroller it's fine, that works. No problem.
On this viewcontroller and every subsequent view controller including tableviews with options to select, if you touch anywhere underneath the cancel and next buttons inside the view controller, it dismisses the view controller and goes back to the previous screen. There doesn't appear to be anything executed in my code when this happens. It just dismisses the view controller as if one pressed the back button. I know the back button code is not being executed because I printed a line in there.
The next view controller is a tableView and does not have a textView. It's got nothing to do with the textView. It just dismisses if I touch anywhere on the screen other than the next or cancel buttons. The next views are the exact same way. It's like a big invisible button is in the way of the screen blocking any interaction with the top half.
What's going on here? How do I fix this? It has never done this before and I didn't change anything.
Turns out that this was caused by using page curl transitions. I changed it to flip horizontal and it works now. Page curl transitions are obviously bugged currently.

Show (Push) Segue Leaving Imprint of Previous View

I have two views. Upon clicking a button, the other view should be segued onto the screen with a show (previously called push) segue. This works flawlessly, however, for some strange reason when transitioning a short imprint of the previous view is left behind. This seems to be happening only for these 2 views, I can not reproduce it with others, and the bug occurs both on the simulator and an actual device. Here is a GIF of what is happening: https://gyazo.com/662a813de15ba90d6581976f55866289
(Stackoverflow doesn't support direct Gif's in post as far as I'm aware, so sorry for the external link)
Sorry for the low quality.
I simply control-dragged from the "Signup" button to the other screen to create the segue. This seems to be the only transition that is doing this throughout my entire app. This is what it looks like in storyboard. I'm doing nothing programmatically before/after the segue sends.
I've tried programmatically creating the segue as well, however the same effect is occurring. I could not find any similar stackoverflow posts.
Any clues on why this is happening and any possible fixes would be great. If you need more information please let me know.
Edit:
I am not doing anything to resource extensive on the view initialization (I'm simply making the nav bar translucent and modifying a few outlets). I feel it is important to note that the background (The blue) and the sonus logo are both Image Views. I've attempted programmatically setting the background image, however this made no effect on the outcome of the problem.
Go through the below Solution:
Click on "Second View Controller"
Select the top UIView
Now change it's background color to Default
This will solve your problem!

Weird segue transition after disabling autolayout

I don't know how to explain this, it's really strange.
Ok think about two view controllers, the first one is a tableview controller and has a button in his navigation bar connected via push segue to the second view controller.
When pushing the button, the second view controller comes in from the right and at the same time pushes the first view controller out, to the left.
I wasn't using auto layout for my project but I've activated it to test something (I've just activated two constraints for two labels in the prototype cell). Then I've disabled the auto layout and now when I push the button on the first controller the second one comes in, but instead of pushing out the first controller, it slides on the back of the first one, that disappears only when the animation ends.
It's like if all the cells in my first controller become transparent during the transition.
I can't see anything strange in my settings so I don't know how to solve this.
Well, as Ryan said, it was one of those annoying problems where you dig around for 30 (for me it's been 90) minutes with no success and then find out how to fix it with a single click.
It turns out that the second view controller had a transparent background (don't know why), so reverting it to white solved the problem.
Thanks God I din't delete the storyboard to make it ex-novo.

Resources