Weird padding at top UINavigationController while animating to detail in iOS11 - ios

I'm posting here because I'm completely lost on this one.
I've searched all over the web, tried a lot of things myself, and searched weeks on this bug, but I can't find it.
So ever since iOS 11 (doesn't happen on iOS 10), everytime I press a button that activates the "show" segue in a UINavigationController the animation shows some weird padding at the top.
This padding disappears when the animation is finished.
I've changed the backgroundcolor of the superview to a red color, and the space you can see is indeed from the superview itself, so my guess is the whole UITableView is being moved down for some reason, although I'm not sure what exactly is the cause here.
(I'm using storyboard and AutoLayout constraints)
Another thing I noticed is that the spacing/padding you see is different on the iPhone X compared to the other devices (my guess is that it's the same height as the (non)safe area at the top? Again, not sure.
I don't think code is necessary to be provided here, as I wouldn't really know which part causes this behaviour (and there's a lot of code that I can't share for reasons..).
Any suggestions/help on how to fix this would be deeply appreciated!
Here are some examples:
iPhone X running iOS 11.1 (also happened on 11.0)
iPhone 8 gif
EDIT: I should add, some things I already tried:
tableView.contentInsetAdjustmentBehavior = .never
Setting headerviews to 0
tableView.setContentOffset(0, animated: false)
Playing with the translucency settings of the UINavigationBar
AutomaticallyAdjustContentInsets is set to false

So, as suggested by Spenser-Arn, I played around with the constraints and the Safe Areas, turns out, the safe areas where the cause of the issue.
Hope this helps other people as much as it helped me, and a big thankyou to Spenser-Arn!

Related

Xcode Swift - iOS 10 & iOS 9 Text size problems

I've got a few buttons with text inside. If i run the app on an iOS 10 device, it works and shows the text fine. But running the app on iOS 9 the text inside the button is like "squashed" or "compressed"(the text on version 9 is missing the top and bottom part of the text). I'm not sure why this is happening, I've tried messing around with the hugging and compression settings on the UI Builder, but this hasn't really fixed the problem.
Not sure why it works on 10 but not on 9....The image above shows what the text looks like on iOS 9 ONLY!
I'm just seeing if this is happening with anyone else? or if anyone knows how to solve this problem?
I appreciate any help given! Thanks in advance!
You have to use "adjustsFontSizeToFitWidth" property of titleLabel of your button
Example:
myButton.titleLabel.adjustsFontSizeToFitWidth = YES;
There are a few possibilities:
The height of the button during runtime could be wrong. Try setting a border to the button, run and observe the button outline to see if the height is correct.
myButton.layer.borderColor = UIColor.black.cgColor
myButton.layer.borderWidth = 1
If the height is wrong, it means the constraints could be incorrectly set up.
Another possibility might be contentEdgeInsets, titleEdgeInsets properties of the button having larger than intended top and bottom values.

ios 9, white splash screen instead of launch image, working fine previously, seemingly nothing changed to cause it

When my app launches, I see a white screen, instead of my launch image. I am using a storyboard, as required, and everything was working fine for about 2 months before this. I didn't change anything related to the image or storyboard either, it just started happening. I should mention that this started happening sometime after my first time uploading to TestFlight...but I doubt that is relevant. I have tried changing the constraints of the image to make it smaller than the bounds, and it still doesn't show up, so it isn't the size of the image. Again, I seemingly did nothing to have this start happening. Most of the questions related to my problem on stackoverflow have to do with the user not using a storyboard as required with iOS 9. Please help. Thanks.
UPDATE
I launched it on the simulator (iPad2) and the launch image for that was too small...there was white exposed above and to the right, I'm guessing I need to fix something in the storyboard but I'm not sure what.
UPDATE
I made a new storyboard and assigned the launch-screen config to it, and there is still a white screen.
I deleted the UIImageView and then inserted a new one with dimensions 200 x 200.
I added the image to the UIImageView.
I adjusted the constraints to the same values that I was using before.
Adding the image to the 200 x 200 UIImageView, before adding the constraints, seemed to be the key.
Make sure that one of the view controllers has the Is Initial View Controller checkbox checked in the Attributes Inspector in the right sidebar, that got me.
In project by default you LauchScreen.xib. Put your launch image there and set it’s top, bottom, leading, trailing constraints. Tap your project file and scroll down. There you will see: LauchScreen option and MainStoryboard. Set LauchScreen to your LauchScreen.xib. That’s it))

iOS 9 CollectionView slowing down

I have been developing my app for iOS8, and haven't really had any issues regarding the scrolling speed. The moment I have upgraded to iOS9 the collectionView became very jumpy and staggering. I cant point out to any specific reason why. In my collection view, I have items with images that uses 3rd party library (SDWebImage) and I also use a custom layout library to achieve double column layout. Is there any obvious reason why this could be happening?
We were experiencing the same issues with collection views with iOS 9. The cells also contained images from SDWebImage including animated GIFs. It turned out not to be an issue with SDWebImage but with auto layout. If you have layout constraints with <= or >= inside your UICollectionViewCells (particularly on UITextViews, but still visible on UILabels, iOS 9 just chugs. Hope this helps someone.
In this case the problem was about handling fallback images on the imageView.
Briefly, each item in the CollectionView has an UIImageView. Each UIImageView has a fallback image in case the actual image doesnt resolve (the url is broken for example). So, the way these fallback images set was wrong in my app! I have set images every time a collectionview item is rendered in the viewport.
UIImageView * fallback = [UIImage imageNamed:#"imageName"];
was called everytime, which makes the scroll staggered. Interestingly it wasnt an issue on iOS8 but only in iOS9.
So when I started reading from a precreated dictionary of images instead of creating a new one every time, the scroll view started become smooth again.
Hope this helps to those having the same issue.

iOS 9 Segue Causes App To Freeze (no crash or error thrown)

I have been working on this app for months now and from as far back as I can remember I have never had an issue with segues. The code is unchanged in terms of calling performSegueWithIdentifier but since my recent update to Xcode 7 and iOS 9 I have not been able to tack this issue.
I have tried:
Deleting button and creating new button w/ segue link
Using a direct segue from button to view, without the use of performSegueWithIdentifier
Connecting button to new blank viewController
When I press the button, no initial load functions are called on the destination VC (Ex: ViewDidLoad, ViewWillAppear, etc). When I connect it to a blank view, the segue works fine with the same code in place.
Since the code never stops, or breaks, and just seems to "freeze" in place while still running on Xcode I can't seem to even narrow this down to whats causing the issue. I have a similar segue that is also called from another button on the same ViewController that has no issues whatsoever.
Any thoughts on the matter are greatly appreciated!
EDIT: I have narrowed the issue down to the UITextView's causing the problem. Once the Text Views were removed the page loads fine via segue. I wonder what changed between iOS 8 and iOS 9 in terms of UITextView as I will have to remove the text views and completely re add new text views.
So basically the segue was freezing because of the UITextView's I was using in the destinationViewController. The following fixed the issue:
Delete all UITextView's
Add new UITextView's
you must leave the default lorem imposed text and change this programmatically in the viewDidLoad()
This was the fix for me, and from the research I have done on the issue it seems this is a bug in iOS 9 and Xcode 7.
Cheers!
NOTE: Removing the text in the UITextView (or making it longer then ~12 characters) is sufficient to work around it, no need to delete and recreate them. This is fixed in Xcode 7.1.1 and later.
I ran into the same issue and the fixes in this post (Xcode 7 crash: [NSLocalizableString length] 30000) solved the issue for me.
The first is to enable a localisation other than the base for the storyboard (see https://stackoverflow.com/a/32688815/3718974)
The second is to turn off the base localisation (see https://stackoverflow.com/a/32719247/3718974)
I think I have the same problem: I have a UITabelView with cells created from a nib file, when a user tap a cell this method is called:
and when I have the following method prepareForSegue:: the application crashes:
if I delete the line 129 Everything is ok , the method prepareForSegue:: open the right view and the label contactName is shown with its default text.
If I modify the method as follows prepareForSegue:: get exactly what you expect, without having any type of error:
let me know if you also get the same result
Any one who is facing this issue, i solved it by turning off the "Optimize rendering for windows scale" option in Debug of simulator window. I already had tried all of the above answers but could not solve the issue.
In the method in the first viewController where you activate the segue, do you have beginIgnoringInteractionEvents anywhere? If so the screen you segue to will be frozen and will ignore interaction events like you describe. If this is the case you can fix this by adding an endIgnoringInteractionEvents method before your segue method:
UIApplication.sharedApplication().endIgnoringInteractionEvents()
self.performSegueWithIdentifier("editItemToMyGearSegue", sender: self)
I realize this is an old topic, but appears to be still relevant. I was facing the same problem in Xcode 9, iOS11. My UITextViews are embedded inside UITableViewCells. Same symptoms as described here. The tricks with default text and placeholders did nothing for me, but I solved it by turning off the scrolling indicators for the text view in the xib. They were on by default, I guess, though unused.
Edit: this is probably an important detail... the views that were hanging all had an image NSTextAttachment in the attributed string of the text view. I think the image was wider than the available table cell content. With scrolling turned off, they appear to downscale.

Indentation of UITableViewCell changes after rotation only on iOS 8

I have an UITableView with three dynamic rows. When displaying the UITableViewController the first time everything works fine. After a rotation the rows which have a data in it get an indentation despite I set setLayoutMargins to zero. I cannot reproduce this issue in another project until now. It is only appearing in iOS 8 but but only on one table. The same source for the table is working in a test project without problems. The only difference here is that it is in a container with some other views.
I checked auto layout constraints, the rotation methods, commented things out - all without success. The change of the indentation occurs between willRotateToInterfaceOrientation and didRotateToInterfaceOrientation or after viewWillTransitionToSize. I even updated to iOS 8.1 with the same results.
Has someone expeerienced a similar behavior?
PS:
What I've also noticed that when setting the layout margins to zero on iOS 8 the animation is not as smooth as it would be with the default values (with indentation). On iOS 7 the animation is always smooth.
EDIT:
I tracked some things down. If a UITableViewController is embedded into an UINavigationController the indentation happens on rotation. If you rotate further it goes back to it's set indentation (no indentation in my case).
If the UITableViewController is embedded into a container (and this container is in a navigation controller) than after the rotation the cell get it's default indentation back. If you rotate further this behavior stays the same (always indented).
Are some events not send to the child view controller or none of you uses a UITableViewController embedded into an UINavigationController?
In my opinion it is a iOS 8 Bug or a Xamarin Bug. Perhaps one other could verify if it is the same with his installation. I'm using Xamarin Studio 5.5.2 with Xcode 6.1.
One ugly solution to this is this:
public override void DidRotate (UIInterfaceOrientation fromInterfaceOrientation)
{
base.DidRotate (fromInterfaceOrientation);
// otherwise cells are indented! iOS 8 Bug?
TableView.ReloadData ();
}
One could use reloadData or reloadSection in didRotateFromInterfaceOrientation, despite it is a deprecated function. But there is no viewDidTransitionToSize and I also have to support iOS 7.
Edit:
Another solution I have come up with is to draw a custom separator line. This only works for iOS 8 and would answer the question (despite I've another issue on iOS 7 where this approach doesn't help).

Resources