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

Reply
 
LinkBack Thread Tools Display Modes
Old 10-15-2010, 02:00 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
noobdev is on a distinguished road
Default UITextView scrolls up content when first clicked

Hi all!

Sorry this is a repost - I posted in the wrong section the first time.

I've been trying to fix this problem for a few days now and I'm still no where nearer to an answer. I'm using a UITextView inside a UITableViewCell. If I enter one line of text into the textView, dismiss the keyboard, everything is displayed nicely and properly.

My issue comes when I click on the textView to edit it again. When I click on it, for some reason the content is scrolled upwards out of the frame. This is how the textView was created and displayed:

CGRect rect = CGRectMake(0, 0, 300, 30);
details = [[UITextView alloc] initWithFrame:rect];
[details setScrolledEnabled:NO];
[details setReturnKeyType:UIReturnKeyDone];
[[cell contentView] addSubview:details];

I've tried using content offset to stop it from scrolling but it doesn't seem to help, does anyone have any ideas?

Thanks in advance!
noobdev is offline   Reply With Quote
Old 10-15-2010, 04:04 AM   #2 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 49
Angel is on a distinguished road
Default

Instead of specifying the frame manually, use the cell frame.

details = [[UITextView alloc] initWithFrame:cell.frame];

Hope this will be useful.
Angel is offline   Reply With Quote
Old 10-17-2010, 09:57 AM   #3 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
noobdev is on a distinguished road
Default

Quote:
Originally Posted by Angel View Post
Instead of specifying the frame manually, use the cell frame.

details = [[UITextView alloc] initWithFrame:cell.frame];

Hope this will be useful.
Hi Angel, thanks for your suggestion. It didn't actually work until I manually changed the height of UITextView to be bigger than necessary. After I did that it seemed to have worked!

Thanks though

Noob
noobdev is offline   Reply With Quote
Reply

Bookmarks

Tags
scrollview, text, uitextview, view

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: 350
7 members and 343 guests
Desert Diva, dre, hain, HemiMG, lendo, mottdog, oceanlablight
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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