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 Tutorials > Tutorial Requests

Reply
 
LinkBack Thread Tools Display Modes
Old 06-20-2010, 04:24 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 3
nielololek is on a distinguished road
Default Programmatically scroll a UITextView down

I am new here, so hello !
I would like to know, how can i programmatically scroll the UITextView to the bottom.
I have a function, which adds a new line to that TextView and when there are more than few lines, the user has to scroll the TextView manually to see new those lines.

When i click the TextView few times and then call that function, it automatically scrolls down. I don't know it's a bug or not, but i'd like it to happen all the time.

I've tried with this:
Quote:
[myTextView scrollRangeToVisible:range];
But it didn't work or just crashed (OS 3.1.3).
I hope you guys will help me.
Thanks.

Last edited by nielololek; 06-25-2010 at 11:31 AM.
nielololek is offline   Reply With Quote
Old 06-20-2010, 04:28 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 3
nielololek is on a distinguished road
Default

I've done it !

I just put this:
Quote:
[myTextView becomeFirstResponder];
in the viewDidLoad method and it works now !


You can now delete this topic or leave it for people like me.

Last edited by nielololek; 06-20-2010 at 04:35 AM.
nielololek is offline   Reply With Quote
Old 06-25-2010, 11:25 AM   #3 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 3
nielololek is on a distinguished road
Default

I have a problem with this in iOS 4 :/
When i use it, the keyboard disappears. (due to this: [textField becomeFirstResponder]).

So, is there any other way to scroll the UITextView to the bottom in the newest iOS ? I want to scroll the textView and keep the keyboard visible at the same time, so i can't use two "becomeFirstResponder" calls. (The keyboard disappears when the Done button on it is clicked)

I tried doing this:
[textField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.001];
and it works, but the keyboard is shaking for a moment. (even if i write 100 zeros in "afterDelay:" argument.) I dont want this "shake" effect.

Thanks.

Last edited by nielololek; 06-25-2010 at 11:30 AM.
nielololek is offline   Reply With Quote
Reply

Bookmarks

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
» Stats
Members: 175,696
Threads: 94,139
Posts: 402,961
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jasper_muc
Powered by vBadvanced CMPS v3.1.0

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