Yalantis/Segmentio

Misplace when using Segmention together with iOS11 search bar in navigator

thales-gaddini opened this issue · 2 comments

Report

Report a bug

What did you do?

Added the Segmentio component to a UIViewController by adding a new UIView and setting the class to Segmentio and constraining it at the top with a fixed height. Afterwards I added a search bar in the navigation bar programatically.

In iOS11 the search bar has a height a bit bigger than before (12px), which is not influencing only the bottom line Y position.

What did you expect to happen?

For the lightGray line to be at the bottom, not in the middle of the segment.

What happened instead?

The lightGray line has an offset from the bottom (12px) because of the search bar.
img_0277

Your Environment

  • Version of the component: ~> 2.1
  • Swift version: 11.2
  • iOS version: 11.2.1
  • Device: iPhone 8 Plus
  • Xcode version: 9.2
  • Cocoapods:

Stack

   CocoaPods : 1.3.1
        Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
    RubyGems : 2.5.2
        Host : Mac OS X 10.13.2 (17C88)
       Xcode : 9.2 (9C40b)
         Git : git version 2.14.1
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ daba41f8102fc98d4b3f264f46cf0a8583b891fa

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.0
cocoapods-try         : 1.1.0

Project that demonstrates the bug

I'll try to get one by the end of the week.

The collection view cells of Segmentio seems to disappear when search controller is active.
Sharing some of my findings here.
searchControllerNotActive

When searchController becomes active,

searchControllerActive

I also noticed that cell.isHidden = true but it doesn't seems to be the cause.

<Segmentio.SegmentioCellWithLabel: 0x7f9ff8c5ccd0; baseClass = UICollectionViewCell; frame = (0 0; 187 50); hidden = YES; layer = <CALayer: 0x600000a53d60>>

Quick fix
The bug seems to happen when Segmentio view is first view at the top.
I've resolved it by adding a dummy view with a height of zero above the Segmentio view. See attachment

SegmentioFix