Question

alt text http://www.davidhomes.net/question.gif

I'm farily new to iphone dev (<3 months on my free time) and I'm starting development of my second app.

From the image, I'm adding a number of UIViews as subviews to my main UIViewController.view, the number of Views to add varies based on user selectable data.

Each view contains several controls, a label, a UITextField and a Horizontal UIViewPicker.

For simplicity I put a (VERY ROUGH) mock-up here with only two buttons.

Because I want to improve the GUI, I want to overlay an UIViewImage as the top sub-views of the added UIView, something like in the image.

The question is on passing through the events to the objects below it. I've read somewhere that one way was to use clipping, but the actual shape is more complex than just an oval frame.

Somewhere else I read that one could add four UIImages, one at each border, which would let the events pass through this hole. Seems like a dirty solution to me (Although I'm sure it would work)

Any ideas about the best way to do this? Any links to a tutorial or recipe online?

Your help is appreciated

thanks david

Was it helpful?

Solution

Have you looked at protocols? You can define protocols for your views or objects, and the users of that object (the subviews underneath for example) can implement the protocol, set itself as the objects delegate and when actions happen they will notified through the protocols. So for example

An AboveView will declare a protocol that declares methods when a certain gesture was senced by that view so something like -(void)didMakeCircleGesture... as a property the underneathview will have a delegate, so in your method that actually sence the gesture youll have at the end something like

[delegate didMakeCircleGesture];

in turn the delegate is the view underneath or something, and it will conform to the protocol defined by the AboveView, and as part of it it will have to declare the method didMakeCircleGesture, so as a result when one makes a circle gesture in the AboveView the underneath view that conformed to the protocol will be told of the event and it can take appropriate action

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top