UITextView Paging Enabled Text cut off - iphone

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.

Related

UIView container to autoscroll on keyboard resize

I have a UIViewController, it's a view (UIView) containing two elements - UIPageControl and also a UIScrollView. Now, when using normal keyboard, the view is a perfect fit, sharing the screen with the keyboard. But when an international keyword is used, the keyboard would add an extra ribbon for showing the international characters. When that's happened, the view would be covered by the extra keyboard ribbon. The view can't be resized as the UIScrollView view contains a table of two rows of fixed size. So now I am wondering if I should find a way to allow the UIView container to up shift to accommodate the ribbon and shift back when the ribbon disappears. Or is there any other better solutions to work around the issue?
Check out my answer to this stackoverflow post here: detect the appear and disappear of international keyboard
Basically, you'll want to sign up to receive notifications about when the keyboard is shown. From there you can get the keyboard frame size and then adjust views in your window to display properly. The tutorials in the post really do a good job explaining how to do this. Check them out! If you still have questions I can try to help you with specifics.

UITextView hiding some text

I have a UITextView with the Height of 150. I fill up the content dynamically. So, sometime I need to scroll to see the text. But last 3 lines of the content is hidden, it only shows when I scroll the content up. It will hide once I leave the scroll.
Any help to see all the content on the screen with UITextView?
Are you setting the text programmatically after the view is loaded? If so, you may need to resize the content view.
You can also check your nib to make sure the textview isn't hanging off the edge of its parent view ever so slightly.
Finally, you can try resizing the content view to be about 15 pixels higher than it already is.
I would put 2 UITextView inside a UIScrollView. I would then place then accordingly: first the one you want always to be visible and secondly the one you want to stay hidden unless the user scrolls up. To do that, just add then to the UIScrollView and then tweak with the contentSize until you find what you need.

Display lines of data with horizontal and vertical scrolling iOS

I wish to display a dynamic set of data (pulled live over a TCP connection) on the iPhone that is not too unlike lines from a terminal.
This means that the lines will be very long and really cannot be wrapped.
What is the best way of accomplishing this?
I want to use a UITableView because then memory issues would be less of a concern because the lines of text would be loaded/unloaded automatically each line of text would be a cell.
I have thought about this a bit and I came up with a possible solution, but I am not sure if it would actually work.
I could put a UITableView in a UIScrollView and only let the containing UIScrollView scroll horizontally.
Then I would adjust the frame of the UITableView and UITableViewCells so that they are much wider as calculated by the longest line of text.
I have read that you really don't want to nest a UITableView in a UIScrollView since UITableView is in fact a subclass of UIScrollView. Since UITableView is a subclass of UIScrollView, is there someway I can enable the horizontal scrolling and make the frame wider?
If either of those ideas would actually work, could you also tell me which properties I should change (frame or contentSize etc).
I ended up putting a UILabel in a UIScrollView and just kept an array of all the lines and made the UILabel the minimum necessary width and height.
I then set the number of lines of the UILabel to the number of elements in the array. This works because there is no textwrapping.
I think this should be fine performance wise, but we'll see.
You can see it in action in my app Adminium for Bukkit/Minecraft:

Achieving dynamically growing TextView inside UITableView

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.

Resize UILabel text with swipe to delete

I am having some trouble getting my application to properly resize the text of UILabels when the user does a swipe to delete or other type of delete. Currently, the delete button is covering up the text that is in the cell (if it is really long). I would like for them to operate like how SMS (move clipped text down a line) or iPod (delete button resizing text).
I am using a custom UITableViewCell I am working with two labels, UIImageView and a couple of subviews for backgroundView and selectedBackgroundView. I have been playing with the springs and struts of the labels in the cell and partially attained my desired effect however, the text has a weird, quick resizing bug where it becomes deformed and stretched out and then is returned proper size when the delete button is done animating.
As far as other things that I have tried, I have made sure that my text does not adjust-to-fit and I have made my minimum font size the font size that I set for the label. I have also tried over-riding layoutSubviews but that didn't seem to have any effect at all.
If a screenshot (of the deforming label) or code would be helpful, I can post both but since nothing I have done is working, I figured they would be of little value.
fixed it by setting the "mode" of the label in the view panel to "left"
It sounds like you need to set the number of lines property and the wrap property for the labels.
If your actively changing the size of the label itself, you might want to animate that change.