Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

iOS 11 breaks slacktextviewcontroller #604

Closed
4 tasks done
JosephShenton opened this issue Jun 7, 2017 · 16 comments · Fixed by #624
Closed
4 tasks done

iOS 11 breaks slacktextviewcontroller #604

JosephShenton opened this issue Jun 7, 2017 · 16 comments · Fixed by #624
Labels

Comments

@JosephShenton
Copy link

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Description

Cannot press the textview due to there being an invisible view over it.

Reproducible in:

  • This is reproducible in the sample project.
    SlackTextViewController version:
    iOS version(s): 11
    Device(s): All iOS 11 compatible devices.

Steps to reproduce:

  1. Install iOS 11
  2. Run SlackTextViewController Demo
  3. Try clicking the textview

Expected result:

Expected me to be able to send messages etc

Actual result:

Couldn't open textview

Attachments:

img_6866

@hipwelljo
Copy link
Contributor

Confirmed 😮

@JosephShenton
Copy link
Author

@hipwelljo however it works on apps built pre iOS 11 which is wierd

@claudiumatei
Copy link

claudiumatei commented Jul 4, 2017

It seems that this bug is caused by a new subview which is added only for iOS 11

On iOS 10, the subviews array for textInputbar looks like this:

(lldb) po self.textInputbar.subviews
<__NSArrayM 0x170c5cbf0>(
<_UIBarBackground: 0x15fdbc650; frame = (0 0; 375 48); userInteractionEnabled = NO; layer = <CALayer: 0x1746370a0>>,
<UIView: 0x161a03f50; frame = (0 0; 375 0); clipsToBounds = YES; hidden = YES; layer = <CALayer: 0x174636340>>,
<UIButton: 0x161a04fb0; frame = (0 48; 0 0); opaque = NO; layer = <CALayer: 0x174635e20>>,
<UIButton: 0x161a05530; frame = (375 11; 0 30); opaque = NO; layer = <CALayer: 0x174635d40>>,
<SLKTextView: 0x16085f400; baseClass = UITextView; frame = (8 5; 359 38); text = ''; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x174851640>; layer = <CALayer: 0x174636ec0>; contentOffset: {0, 0}; contentSize: {359, 38}>,
<UILabel: 0x161a05ab0; frame = (367 5; 0 0); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x174482760>>
)

On iOS 11, the subviews array for textInputbar has a new element, which is right at the top of view hierarchy.

(lldb) po self.textInputbar.subviews
<__NSArrayM 0x60800287a9c0>(
<_UIBarBackground: 0x7fabd172c630; frame = (0 0; 375 48); userInteractionEnabled = NO; layer = <CALayer: 0x608000a2fc20>>,
<UIView: 0x7fabd17224e0; frame = (0 0; 375 0); clipsToBounds = YES; hidden = YES; layer = <CALayer: 0x608000e25f20>>,
<UIButton: 0x7fabd1720590; frame = (0 48; 0 0); opaque = NO; layer = <CALayer: 0x608000e35ea0>>,
<UIButton: 0x7fabd150e3b0; frame = (375 11; 0 30); opaque = NO; layer = <CALayer: 0x6000012323a0>>,
<SLKTextView: 0x7fabcf864000; baseClass = UITextView; frame = (8 5; 359 38); text = ''; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x608002662580>; layer = <CALayer: 0x608000c32640>; contentOffset: {0, 0}; contentSize: {359, 38}; adjustedContentInset: {0, 0, 0, 0}>,
<UILabel: 0x7fabd153a1e0; frame = (367 5; 0 0); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000068d570>>,
<_UIToolbarContentView: 0x7fabd17276d0; frame = (0 0; 375 48); layer = <CALayer: 0x608000a291e0>>
)

Notice the _UIToolbarContentView subview, right at the top (aka last object from subviews array)!

A quick temporary workaround is to do something like this in your controller:
[self.textInputbar sendSubviewToBack:[self.textInputbar.subviews lastObject]];

Or:
[self.textInputbar bringSubviewToFront:self.textInputbar.rightButton]; [self.textInputbar bringSubviewToFront:self.textInputbar.textView];

Hope this is good enough until we have a proper fix

@markdaws
Copy link

markdaws commented Jul 6, 2017

@claudiumatei - thanks for the workaround. If I add this code, I can now type in the input box (in the simulator using a keyboard) but the keyboard does not appear on on a device when you click on the text input box. Do you have the same problem or know of a workaround to make the keyboard appear?

paulcarpenter added a commit to Recfive/SlackTextViewController that referenced this issue Jul 8, 2017
paulcarpenter added a commit to Recfive/SlackTextViewController that referenced this issue Jul 8, 2017
@hipwelljo
Copy link
Contributor

The workaround committed by paulcarpenter is working nicely for me.

@dzenbot dzenbot added the iOS 11 label Jul 17, 2017
@tylerjames
Copy link

This workaround is not going to play well with the newly announced iPhone X. You're not allowed to put any interaction elements in that area due to the rounded screen.

I think our days of putting a text field right at the bottom of the screen are over. You'll notice that Apple doesn't even do this in the Messages app anymore, they have that annoying iMessage apps bar.

@eliot1019
Copy link

It seems that inserting or deleting rows causes the entire tableView to stop responding as something is wrong with layout of the views.

dzenbot pushed a commit that referenced this issue Sep 21, 2017
…ne layout.

This fixes #604 rendering SLKTVC useless in iOS 11 since UIToolBar's view hierarchy has drastically changed since, conflicting with the internal outlets of SLKTextInputbar
@dzenbot
Copy link

dzenbot commented Sep 21, 2017

Any review/testing of the above fix would be helpful ☝️

@hipwelljo
Copy link
Contributor

@dzenbot Haven't tried it, but wanted to note a UIView subclass would be a solid background instead of the translucent blurred toolbar. (Though it seemed the toolbar wasn't actually translucent anyways, I didn't see elements through it in my app). Just wanted to be sure that's what is desired now.

@dzenbot
Copy link

dzenbot commented Sep 21, 2017

So people may want to have blurred toolbar effects, indeed. I though of that, and this should be as simple as making the view translucent and add a UIVisualEffectView to allow that effect.

This change will certainly not be backwards compatible for those use cases, but there is a simple workaround.

@abildgaard
Copy link

I tested #624 and it works for our application - thanks

dzenbot pushed a commit that referenced this issue Sep 22, 2017
* Fixed Xcode warnings + deprecating -shouldProcessTextForAutoCompletion:

* Making SLKTextInputbar a UIView subclass instead, with its own hairline layout.
This fixes #604 rendering SLKTVC useless in iOS 11 since UIToolBar's view hierarchy has drastically changed since, conflicting with the internal outlets of SLKTextInputbar

* Changelog
@erikhric
Copy link

I programmatically called becomeFirstResponder() on the textfield. Keyboard appeared, but the textfield was still on the bottom 😾

@arthurgarzajr
Copy link

I am using cocoa pods. What do I need to do to get this update?

jakubpetrik pushed a commit to loopsocial/SlackTextViewController that referenced this issue Sep 25, 2017
* Fixed Xcode warnings + deprecating -shouldProcessTextForAutoCompletion:

* Making SLKTextInputbar a UIView subclass instead, with its own hairline layout.
This fixes slackhq#604 rendering SLKTVC useless in iOS 11 since UIToolBar's view hierarchy has drastically changed since, conflicting with the internal outlets of SLKTextInputbar

* Changelog
@iospro
Copy link

iospro commented Sep 27, 2017

To solve the problem for iOS11 (compatible with lower versions) you only need
to make layoutSubview right after UIToolBar was added as a subview to UI hierarchy.

In this case _UIToolbarContentView lowers to the first subview of UIToolBar, and you can
add all your subviews higher as before.

For example in ObjC,

    UIToolbar *toolbar = [UIToolbar new];
    [self addSubview: toolbar];
    [toolbar layoutIfNeeded];

    <here one can add all subviews needed>

@dzenbot
Copy link

dzenbot commented Sep 27, 2017

Interesting. Still, it seemed better to simply stop using UIToolbar altogether. We were only using it for getting the built-in blurring effect and the hairline anyway. With the current fix, only the blurring effect would need to be added adhoc by developers, if needed.

paulcarpenter added a commit to Recfive/SlackTextViewController that referenced this issue Nov 3, 2017
@Balasubramanian93
Copy link

Hi Guys,

I am facing different issue. Contents drawn on the CGContext of the UIImageView got disappeared. I have attached the video which demonstrates the issue i was facing in my side. I am getting this issue only in iOS 11 iPad. I could not reproduce the issue in iPod/iPhone with iOS 11. Can you please let me know if you have any idea on this?

Video: https://www.dropbox.com/s/7nhnaqdhh8ha7u1/Untitled.zip?dl=0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet