I got UITableView with e.g. 5 sections . the headerViews of each section are UIWebViews (to display html formatted Text).
While scrolling to a section header which wasn't in window before. the html content is empty until the scroll animation is stopped. after stopping the UIWebView loads its content.
is it possible to view the text while scrolling like a label?
You can use coretext for this purpose. Its simply awesome just as using a UILabel.
You should read this article: http://nickharris.wordpress.com/2010/06/17/fast-uitableviewcell-with-a-uiwebview/
It explains your problem very well and also comes with some code that will help you!
[edit]Also this one, with a github demo here
Related
I have added a UIWebView along with some labels inside UIScrollView (using StoryBoards) by adding it as a subview and then setting the ScrollView height to show all the html content of WebView that is loaded in it using loadHtmlString.
The links in the html content are not working. A little searching revealed that Apple does not recommend putting UIWebView inside UIScrollView to avoid unexpected behaviour. But as i also have to add labels and other stuff other than the UIWebView, so i have to embed them inside UIScrollView.
Is there any way I can make the links work in the html content without violating and Apple's recommendation?
There is no reason to put a UIWebView inside a ScrollView. UIWebView will scroll and zoom and pan the content properly as is. It is sort of redundant unless you have some other layout reasons for example combining it with some other views.
The correct way to add your labels is to add them to a UIViewController or NavigationController and have them positioned around the UIWebView and to also add the UIWebView to that as well.
I'm looking to create the TableView section contained in the header of this tableview (the "margined" area with Eric Mulder typed in). Does anybody have any insight on this matter? Thanks!
You can't do it easily with a delegate method of UITableView. I got it to work by creating an image which contains a the style of the default cells of a table view. Then I simply load it as an UIImageView in my header view of the table view.
For example, you can take a look at my app iCookit (App Store). You can see the work on the 3rd picture. That's the result. It was very easy to do. Just a little bit with Photoshop or Gimp.
Have you tried setting a UIView that contains both the photo well and a UITableView for the name fields as the main UITableView's headerView?
I am working on fitting a UITextView inside a UITableView. My table is grouped style with only one section and one row. I've looked through various previous questions but I am unable to get this idea working. I want the result to be the same as the "notes" section in the Calendar app on iPad. And Apple has done the same thing in the contacts app as well for notes. Do I need to use view animations to make the tableView row keep growing dynamically as and when more and more text is typed into the textView? What is the correct overall approach to make this idea work? Any pointers would be greatly appreciated. I get the points on how to resize the textview depending on text size and how to modify the height of the table row. But how do I make these work together to give it a dynamic animated feel like in the Apple apps?
Also another thing I noticed is that the cursor always lands at the beginning of the text view due to which the text gets overwritten and ugly on appending. Is there any method to get the cursor to go to next to the last character in the textview when I tap on it again while some text already exists inside it?
Thanks
You can refer to this Post for dynamically growing your uitableviewcell.
This library can help you grow UITextView with auto layout
https://github.com/MatejBalantic/MBAutoGrowingTextView
You can set-up the hooks (either in the library or you set-up the UITextView delegate) to make sure size of the table view cell get's recalculated based on the new UITextView size each time content of the text view is changed.
I would like to have formatted, clickable text and images inside a selected UITableViewCell. An example of the functionality I'm looking for can be seen in the iPhone Twitterrific app. When the user clicks on a cell, the cell is highlighted and the various links become highlighted and clickable.
I've seen the idea of using a UIWebView inside a UITableViewCell to handle formatting, but I'm unsure about this. Does that mean that every cell has to have it's own web view? I'm wondering about the expense and performance of such a method. Is there another way to get this functionality using Core Graphics?
I'm using custom drawing currently to draw my table view cells as described in atebit's blog post on fast scrolling.
Craig Hockenberry, author of Twitterrific, blogged about how he did that back in 2008:
http://furbo.org/2008/10/07/fancy-uilabels/
Basically, when the row is selected, he overlays UIButtons where the links are. It's imperfect, as sometimes the button won't fit in the same place the text does.
The first thing I would do is to checkout twitterific's old source code. And see if that version does what you are looking for.
I'm not sure how Hockenberry does it, but generally UIWebviews + UITableViewCells != fast scrolling.
My guess is that each cell does NOT contain a UIWebview until you click in it, when he quickly places a UIWebview in the cell to handle the text formatting. You then have a reusable UIWebview instance that you reuse but just change the content of repeatedly.
I am using a UITextView and enabling paging (in both IB and programatically toggling it on and off). There's a lot of text and when scrolling with paging enabled sometimes the first and/or last line of the currently viewable text ends up halfway in view and half out of view at the bottom or top of the frame so you can only see the top or bottom half of that line of text. (I hope I'm explaining that correctly)
Does anyone know a way to insure that it pages correctly so it there's no lines of text half cut off??
A few notes
1. The font size is adjustable by the user.
2. I've tried setContentOffset,setContentInset,setContentSize and it's not helping (unless I'm using them wrong)
3. I am using a txt file to populate the UITextView
Thanks in advance!!
UITextView is a subclass of UIScrollView. As such I do not believe UITextView actually supports paging as this is a feature of UIScrollView. Can you please take a step back and explain the end goal, as it sounds like rendering an NSString in to a UIScrollView might be actually what you want, instead of a UITextView.