Reputation: 237
I settled the scrollview and the image should be at the top. But when I pushed this view on navigation controller it adds some strange spacing at the top
if let destination = self.storyboard?.instantiateViewControllerWithIdentifier(StoryboardNames.ItemDetailsView.rawValue) as? ItemDetailsViewConroller {
destination.itemEntity = updatedItem
self.navigationVC?.pushViewController(destination, animated: true)
}
But, I'm opening this view from different navigation controllers. From first the sizing is correct (no spacing at the top), but from another I receive this strange bug. Does anyone know why this is caused?
Upvotes: 1
Views: 117
Reputation: 12594
This thing will be happening if and only if you are adding ScrollView or its subclass(tableview,collectionView,textview etc) at first position in viewController's main view. You can move it to second or any other position or solve by doing following thing:
select your viewcontroller, and see its layout attribute as shown in following image, here uncheck the "Adjust Scroll View Insets". This will stop adding 20 pixel space above.
Upvotes: 0
Reputation: 2640
write this below line in your viewDidLoad
method:
self.automaticallyAdjustsScrollViewInsets = false
Upvotes: 1