Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 04-20-2011, 01:20 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 14
snowffer is on a distinguished road
Question How to display both text and images on the same view? Thanks

I know there is an app on iPad called "Flipboard".
There is a view on Flipboard. It contains both text and images. The text is divided into columns. And the text is around the image. I have attach a picture on this thread. I don't know how to implement that effect.



If you can't open the image link, please go to this: https://lh6.googleusercontent.com/_R...nsWithPics.png

I have tried two ways, but both of them failed.

1. Use CoreText frame. This frame can help me make the text block to create columns. But I can insert image into the text block.

2. Use a UIWebView. I can create a html web file which contains columns text and images. And then load it into my UIWebView. At last, I draw it and paste the drawn context to where I want it to be. But the issue is, I can't control the size the text block. Because I control the size with CSS. It seems that I can't re-write the CSS file or html file to fit my iPad's screen. I can't control the image's position where it is shown either.

So is there anybody can give me a way to implement it? If there is, I will appreciate very very much!

Thank you
Attached Images
File Type: jpg columnsWithPics.jpg (8.7 KB, 0 views)

Last edited by snowffer; 04-20-2011 at 01:34 AM.
snowffer is offline   Reply With Quote
Old 04-20-2011, 03:48 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

i think that the more reliable solution is uiwebview, you should be able to change css and what you want to fit your requirements, you can control all, i don't understand what's the problem with that....
Position all programmatically can be painful.....but can be done if you know for example that you will have 3 columns + 2 images, because you can retrieve how many space your text take (on a textview should be textView.contentSize; )

However attachments image doesn't work on this forum
__________________

Last edited by dany_dev; 04-20-2011 at 03:55 AM.
dany_dev is offline   Reply With Quote
Old 04-20-2011, 04:37 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 14
snowffer is on a distinguished road
Smile

Quote:
Originally Posted by dany_dev View Post
i think that the more reliable solution is uiwebview, you should be able to change css and what you want to fit your requirements, you can control all, i don't understand what's the problem with that....
Position all programmatically can be painful.....but can be done if you know for example that you will have 3 columns + 2 images, because you can retrieve how many space your text take (on a textview should be textView.contentSize; )

However attachments image doesn't work on this forum
Thank you very much for your replay. Maybe it's very late on your time zone. If it's very late, you'd better go to sleep.

What I mean "can't control" is that I can't control the property in CSS through my Cocoa project. For example, I could have a html file with its CSS file. All the properties is fixed on the CSS file. The columns count is 3, and size of the text block is 700*900. Now I load the two files into my UIWebView. I read them and want to change the columns count from 3 to 2, and the size from 700*900 to 910*710. I don't know how to do that. How could I change those properties through re-write the two files?
snowffer is offline   Reply With Quote
Old 04-20-2011, 05:15 AM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

yes, you can programmatically change css and html, just open as simple file text, parse what you want, change and save, and reload the uiwebview

the best way maybe is to create a method to create programmatically the css and html (instead of parse a manual written css\html)
__________________
dany_dev is offline   Reply With Quote
Old 04-20-2011, 05:21 AM   #5 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 14
snowffer is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
yes, you can programmatically change css and html, just open as simple file text, parse what you want, change and save, and reload the uiwebview

the best way maybe is to create a method to create programmatically the css and html (instead of parse a manual written css\html)
Thank you. But could you tell me which function or class should I use for re-writing html or css files? I only know how to parse a XML file using XMLParser ...
snowffer is offline   Reply With Quote
Old 04-20-2011, 05:25 AM   #6 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

with that you should be able to parse html\css

htmlcxx | Download htmlcxx software for free at SourceForge.net

is a library written on C++, you should be able to use it...

Or look at ElementParser

but i'm not sure that the best solution is to parse your entire css\html.

What i would try is to create a "template", and then modify some value on it, like a .html as

Code:
<html>
....etc....
numColumns=%@
....etc....
</ html>
so that you can open that file and insert a variable.
__________________
dany_dev is offline   Reply With Quote
Old 04-20-2011, 06:44 AM   #7 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 14
snowffer is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
with that you should be able to parse html\css

htmlcxx | Download htmlcxx software for free at SourceForge.net

is a library written on C++, you should be able to use it...

Or look at ElementParser

but i'm not sure that the best solution is to parse your entire css\html.

What i would try is to create a "template", and then modify some value on it, like a .html as

Code:
<html>
....etc....
numColumns=%@
....etc....
</ html>
so that you can open that file and insert a variable.

Thank you very much for your answer and patience.
snowffer is offline   Reply With Quote
Reply

Bookmarks

Tags
column, image, picture, text

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 370
16 members and 354 guests
AyClass, baja_yu, checkright, dre, epaga, fvisticot, givensur, jPuzzle, Meoz, Newbie123, Objective Zero, Punkjumper, sacha1996, skrew88, tomtom100
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,642
Threads: 94,110
Posts: 402,857
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pinacate
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:34 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0