updated with content insets for portrait view
updated to handle swipe gesture