开发者

iPhone SDK: Adding Images To a UITextView In The Interface Builder

开发者 https://www.devze.com 2023-02-11 20:51 出处:网络
You know how when you开发者_如何学编程 add text to a UITextView and it displays only text? Well, I also want to add images along with the text so that when I scroll, it displays the text with the imag

You know how when you开发者_如何学编程 add text to a UITextView and it displays only text? Well, I also want to add images along with the text so that when I scroll, it displays the text with the images fitted along with the text.

How can I do that in BOTH the Xcode and the Interface Builder??


It's not possible. Instead, you should use UIWebView programmatically in your code.


There is no way to "add in" images to a UITextView. You can place UITextViews (either scrolling or non-scrolling, non-scrolling it sounds like in your case) and UIImages inside a UIScrollView and they will all scroll together, that's probably the easiest way of doing what you want to do.

In code:

UIScrollView *sv = [[UIScrollView alloc] initWithFrame:MyScrollViewFrame];
UITextView *textView = [.. create your text view ... ];
UIImageView *imageView = [... create your image view ... ];
[sv addSubview:textView];
[sv addSubview:imageView];

In interface builder:

iPhone SDK: Adding Images To a UITextView In The Interface Builder

0

精彩评论

暂无评论...
验证码 换一张
取 消