Text is a large part of iOS apps . Today, we are looking for a way that we can polish the text in our apps by allowing it to flow naturally around objects. Let us begin.
We start with a "before" image. Here we have a basic layout with some text and a image in the upper right corner. Nothing too fancy here, just a common UITextView and UIImageView :
la imageView = UIImageView ( image ]: UIImage ( entitled : "steve" )) la textView = UITextView ] ( ] null ) textView . text = "Here are the crazy ..."
This looks great. But our text is unnecessarily narrow. It would be great if we could make the text expand to the full width of the device. We change the text view layout as it does:
Well, we will come closer. Now, we only need a way to make the text "flow" or "wrap" around our image. We start by getting the frame by image view and we will make a lane from:
la imagePath ]  ] rect : ImageView . frame )
Finally, we will put our new lane as one of exclusion paths of the text view
text containers :
text display . textContainer . exclusion paths = [ ImagePath ]
exclusion paths are an Array we can flow text around as many figures as we want!