UITextView BIU button missing on iOS 16 (text formatting)

Hi,

I have a UITextView with allowsEditingTextAttributes set to true.

On iOS 15 and before, users can select part of the text and tap on the BIU button in order to set the text to bold, italic or underline. On iOS 16 the BIU button is missing.

How can the user change the formatting of the text contained inside an UITextView on iOS 16? There is something I need to specify on UITextView?

Thank you

Answered by DaleOne in 737517022

I found the cause of the issue.

My project is a Catalyst project and I used a UIMenuBuilder inside the AppDelegate buildMenu(with:) method to remove some items from the Mac menu bar. One of the item I removed was the format menu (UIMenu.Identifier.format).

This on iOS 15 has no effect to the UITextView menu, but on iOS 16 removing the format menu cause the UITextView menu to also hide the "Format" item. I think it has someting to do with the fact that the item was renamed from "BIU" (iOS 15) to "Format" (iOS 16). So, I added a condition to remove the menu items only when the environment is macCatalyst and now everything works as expected.

Could you show both screenshots, in iOS 16 and before ? As well as the Attributes Inspector parameters for the UITextView ?

I tested on iOS 15.5 simulator and did not get the B/U/I buttons

Hi Claude31.

Did you set allowsEditingTextAttributes to true? When you do that, users are able to change formatting to bold, underline and italics on iPhone via the menu and on iPad via dedicated buttons above the keyboard.

I just tried to create a new project with just a single UITextView and the button correctly appear also on iOS 16 (the name of the button on iOS 16 changed from BIU to "Format"). So, it seems to work with new projects, but in my case, for some reason, all text views in my project are no more showing the "Format" button when the app is executed on iOS 16 (works ok on iOS 15).

I also tried to add in my project an empty controller with a UITextView with all attributes set to defaults values (only allowsEditingTextAttributes to true) and also this text view does not show the "Format" button.

On the new project the options I have in the menu are:

  • Cut
  • Copy
  • Paste
  • Replace...
  • Format
  • Look Up
  • Translate
  • Search Web
  • Share...

On my project the options are:

  • Cut
  • Copy
  • Paste
  • Replace...
  • Look Up
  • Translate
  • Search Web
  • Share...

I'm trying to figure out what in my project is causing all text views to lose the Format button on iOS 16.

Has anyone else had this problem?

Thank you

I added allowsEditingTextAttributes = true

The problem does not show.

  • I gt a B I U option in iOS 15.5

  • It is replaced by a Format menu with the same options when tapping Format:

Accepted Answer

I found the cause of the issue.

My project is a Catalyst project and I used a UIMenuBuilder inside the AppDelegate buildMenu(with:) method to remove some items from the Mac menu bar. One of the item I removed was the format menu (UIMenu.Identifier.format).

This on iOS 15 has no effect to the UITextView menu, but on iOS 16 removing the format menu cause the UITextView menu to also hide the "Format" item. I think it has someting to do with the fact that the item was renamed from "BIU" (iOS 15) to "Format" (iOS 16). So, I added a condition to remove the menu items only when the environment is macCatalyst and now everything works as expected.

UITextView BIU button missing on iOS 16 (text formatting)
 
 
Q