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:43 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 54
warrior is on a distinguished road
Default how to detect the touch (CGPoint) of a scroll view in its content size in iphone?

Hi,

I want to detect the touch (CGPoint) of a scroll view in its content size .If i detect the touch in the scroll i get the CGPoint only with reference to the scroll view frame but i want the position with reference to content size.

Here is my code

-(void)touchesBeganNSSet *)touches withEventUIEvent *)event
{
UITouch* t;
NSLog(@"inside touches began");
if([[event allTouches] count]==1){
t=[[[event allTouches] allObjects] objectAtIndex:0];
p1=[t locationInView:scroll];
}

My scroll view frame is (0,0,320,460) and content size is (320,800);

if i scroll my view and touch it at bottom , the CGPoint value obtained is 450 but i want to get as 750 (with reference to content size).Please help me out.Thanks.
warrior is offline   Reply With Quote
Old 10-15-2010, 03:37 AM   #2 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 1
asarpkaya is on a distinguished road
Default

Here is the code that I am using and it gives me the location of object in parent view.

detecting touch events in object which added in scrollView.

- (void)touchesBeganNSSet *)touches withEventUIEvent *)event {

CGPoint point = [[touches anyObject] locationInView: self.superview ];
NSLog(@"Location in scrollview : %f:%f",point.x,point.y);

}
asarpkaya is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, scroll view, touch

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: 351
7 members and 344 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