I want to add image in UIView using coreText and then text around image like below.
eg..
Baaa
img aaaa
aaaa
aaaaaaaa
aaaaaaaa
aaaaaaaa
I want something like this where "img" is an image..and text start from "B"..
thanks..
I want to add image in UIView using coreText and then text around image like below.
eg..
Baaa
img aaaa
aaaa
aaaaaaaa
aaaaaaaa
aaaaaaaa
I want something like this where "img" is an image..and text start from "B"..
thanks..
You can find a complete working project if you look around here:
http://ios-blog.co.uk/tutorials/rich-text-editor-inserting-images-part-6/
It does exactly what you want but uses a UIWebView instead of CoreText.
Essentially when drawing with core text you are rendering text into paths. You can use the rect of a UIView or draw your own custom path into the current graphics context of a view.
so say you have the following rect:
xxxxxxxxxxx
x x
x x
x x
x x
x x
x x
xxxxxxxxxxx
you would need to draw your path around the image (p == path):
xxxxxxxxxxx
xiiiiPPPPPx
xiiiiP Px
xiiiiP Px
xPPPPP Px
xP Px
xPPPPPPPPPx
xxxxxxxxxxx
you would then tell CoreText to draw your text inside the path. As for actually drawing it - I suggest you read the apple docs - it explains it quite well.
hope this helps,