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 12-20-2010, 01:24 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 49
Derekm9292 is on a distinguished road
Default UISCrollView Help!!

Hello,

I have two subviews that are implemented into my scrollview so that I can scroll between the two of them... On my second view I have a textfield, I need to be able to close the keyboard that belongs to that textField when the tableView slides to the other view. How can I do this? (I would like for it to look similar to spotlight on iOS)
Derekm9292 is offline   Reply With Quote
Old 12-20-2010, 01:41 PM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

to close a keyboard

Code:
[txtField resignFirstResponder];
to know where are you during the scroll of scrollview.

Code:
- (void)scrollViewDidScroll:(UIScrollView *)sender {
	
	int page = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
        NSLog(@"page:%d",page);
}
where pageWidth is your view width (assuming that both have the same width)

so if page = 1 you are on first subview, else you are on second subview.

Create a int that contain currentPage, and when it change to 1, resignFirstResponder your textField.
__________________
dany_dev is offline   Reply With Quote
Old 12-20-2010, 01:59 PM   #3 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 49
Derekm9292 is on a distinguished road
Default

Thanks! It works perfectly!

I knew how to close the keyboard I just couldn't find a way to track where the scrollView was in it's scrolling.

Thanks again!
Derekm9292 is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone sdk, scrollview, uiscrollview

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: 398
9 members and 389 guests
chemistry, daudrizek, HemiMG, jeroenkeij, Kirkout, PavelMik, whitey99
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,665
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, daudrizek
Powered by vBadvanced CMPS v3.1.0

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