The ModMyTM Family of Sites:
ModMyMotoModMyiModMyGphone




 
 
Register or Connect with Facebook

Discuss AppStore Apps | Browse / Search Cydia | MMi Cydia Stats




  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 06-06-2008, 01:33 PM
What's Jailbreak?
 
Join Date: Feb 2008
Device + Firmware: iPod touch 1.1.4
Operating System: Leopard, Vista, XP and Ubuntu ^^
Location: Basel, Switzerland, Europe
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post
Creating Custom Controls

Hi,

For my application I need a color picker control. I subclassed UIControl, and it works fine:

Click the image to open in full size.

But then, I placed the color picker in a cell of a table, and now seemingly it doesn't call the touchesMoved:withEvent method. Because of that I cant "slide" the slider along the color bar. Funnily enough the touchesBegan:withEvent seems to be called, because when I tap the color bar, the slider jumps to the tapped place.
Could somebody help mo out, please? How do I have to handle moving touches like the UISlider control does?

Thanks,
DrummerB

EDIT: I've found a temporary solution. If I set the UITableView's scrollEnabled property to NO, then it works. But I wonder why the UISlider works even if scrolling is enabled...

Last edited by DrummerB; 06-07-2008 at 09:08 AM..
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #2  
Old 12-07-2008, 07:08 PM
What's Jailbreak?
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

See a better solution where:
Apple - Support - Discussions - [iPhone SDK] Events Filtered: UIControl ...


First let me explain what happens:
The UITableView extends from UIScrollView. UIScrollView intercepts all the events to make the decision if it is a scroll or not, if not it passes the event to the subviews. (Except when you have a UIslider)

The solution is to extend UITableView and override this method:
Quote:
-(UIView *)hitTestCGPoint)point withEventUIEvent *)event {

UIView *v = self viewWithTag:999; //999 is the tag of your subview, that you want to capture events
CGPoint convertedPoint = self convertPointoint toView:v;

// If the touch is inside the view, let the view handle it
if (v pointInside:convertedPoint withEvent:event) {
return v;
} else {
return super hitTestoint withEvent:event;
}
}
When you Extend UISlider the hitTest returns the sliderview on a touch event but not when you extend UIControl. That I can not explain.

Overriding the hitTest you can test if the point argument is inside in your view (converting to its coordinates) and Return it the view like what happens in a UISlider.

If someone know why the UISlider is an exception in this hitTest method, please tell us.

Hope this helps you people, trying to capture touches in a UITableView or UIScrollView without the interference of the scrool detection.

Best regards, Joćo
http://www.nanoappz.com/

Last edited by askmehow; 12-07-2008 at 07:10 PM.. Reason: formating text
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion

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



Go to Top
ModMyI

All times are GMT -6. The time now is 07:26 AM. Powered by vBulletin® Version 3.8.4
If you need Dedicated Server Hosting, you should check out SingleHop. | Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 Copyright © 2007-09 by ModMy, LLC. All rights reserved.

iPhone News / iPhone Forums / Apple News / Apple Forums / RSS / Contact Us / / Privacy Statement / Top