Getting viewable text position after scroll a UITextView - cocoa-touch

I have a UITextView and a slide control. The text view has a long content to read. I can drag slide to move text view text to corresponding percentage now. But I want to move slide to corresponding position by scroll text view. I can use an inherit UITextView to catch event. But how I can get current viewable text position?

Related

Animate NSTextField Alignment

I'm trying to emulate the functionality of the Safari url text field (using NSTextField). I'd like the current text to be displayed centered, but when the user clicks on it the text should highlight and slide to the left. I've got the highlighting working but I'm not sure how to go about animating the text over to the left. Is it possible to animate the Alignment property or would I need to do some sort of custom drawing where I animate the position that the text is drawn?
Unfortunately this (Is there a way to animate changing a UILabel's textAlignment?) won't work, since a text field draws a background and border so animating the frame isn't an option.

Border in a UIButton

I dragged A round rect button into the nib and set a background image for the button. However, the image didn't fill up the whole space, it left out a narrow border on the sides of the button. How do I get rid of this border? Thanks.
if you want to use a custom background image for the UIButton, you should change the button type to UIButtonTypeCustom instead of UIButtonTypeRoundedRect.
(you can do this in the Interface Builder as well)

scrollbar contentsize change when keyboard appears

I have a view controller with a scrollview with lots of text boxes, when i click on one of the text boxes and the keyboard appears, the content size of the scrollview isn't long enough to show everything with the keyboard open. How can i change the content size every time the keyboard pops up and set it back once it vanishes?
Also is there a method to make it vanish without resignfirstresponder on every textfield?
Hope someone can help me, I'm pretty new to Objective C.
contentSize probably isn't the property you should be changing.
Try changing the frame property of the scroll view (i.e. make it n pt smaller, where n is the height of the keyboard - 216 in portrait, 162 in landscape.)
The scroll view should deal with letting your content scroll correctly after you've changed it's frame.
The content size property is the size of the thing that is being scrolled - this doesn't change, it's just the amount that you can see that has changed.
(If you're feeling flash, you can animate the change in height of the frame :)

iOS table view having text fields scrolling issue

I have a UITableView which is composed of custom cells. There are 21 cells containing text fields.
When I try to scroll and edit the cells at the bottom of the UITableView, I can't manage to get my cells properly positioned above the keyboard.
Also i created a custom cell class separately for my cells. So keyboard delegates are available on that class only.
I have seen many answers talking about changing view sizes,etc... but none of them has worked nicely so far.
Could anybody clarify the "right" way to do this with a concrete code example?
There are three approaches to this problem all of which tie into the keyboard did / will show notification....
When the keyboard appears, you move the whole view (including tableview) up to ensure the selected textfield is shown on screen, you can calculate this by getting the keyboard height (from the notification) and the textfield position.
You can resize the tableview so that it is only as big as the portion of the screen not covered by the keyboard, again get the height from the notification.
You can set the content inset for the tableview (for the bottom value) to the height of the keyboard.
If you need to, when resizing or repositioning the tableview, you may need to set it to scroll the content to the rect of the text field to ensure it is in view...
- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;

Vb.net - Centering Text inside my label!

I am trying to make my first program in vb.net 2010, and I have a question.
You know how when you have a button, the text centers itself within the frame of the button?
I have a label in my application, that displays a different text (through the label) everyday.
How can I limit the text area, like the frame in the button, and center the text in this text area? Or if it's easier to use the button, how can I remove the frame?
Change the property AutoSize to false and set the TextAlign property to the center.