2

I have two buttons Bold and italic.And 3 lables.Need to do normal bold and italic functionality.I done with manually using UIFont(name: "Helvetica-Oblique", size: 18).But it makes hard to me.

Is there any way to using the default funcions " toggleBoldface(sender: AnyObject>)" and "toggleItalics()".Please give me a demo.I read in apple document https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIResponderStandardEditActions_Protocol/#//apple_ref/occ/instm/NSObject/toggleItalics: But dont know how to proceed with events.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Lydia
  • 2,017
  • 2
  • 18
  • 34

1 Answers1

0

Say you have a UITextView, when you tap the bold button, do the following thing.


@objc func boldButtonTapped() {
    textView.toggleBoldface(sender: nil)
}
JsW
  • 1,682
  • 3
  • 22
  • 34