开发者

Is it possible to create a custom control in iphone

I would like to know Is it 开发者_开发问答possible to create a custom control like in this picture

Is it possible to create a custom control in iphone

it needs to placed on photos which we take from iphone. also the arrows needs to be moved here and there.So i request you guys to clrify me whether this kind controls can be created in the iphone programming.also can apple approves this kind of controls in a app?

Kindly help me out.


Absolutely. My suggestion is to do the following.

Create an image that will be the arrows of the sign post. Then create as many UIButtons as you need posts, setting the background image to that. Add a title, or not, as you like. These will work just like buttons, and be moveable, clickable, etc.

Next make a UIView with the sign post. Add a UIImageView with image the post. Then add the UIButtons to that view.

Then you can drag and drop, animate, or do whatever you like to the buttons (arrows) and sign post separately.


It is definitely possible, and Apple doesn't seem to have any issue with custom controls, we have quite a few of them in our application. I would suggest that you use a UIImageView or put UIButtons on the clickable areas with a blank background image, or I would create a subclass of another UIImageView and use that for the button, then each of the arms could be separate images, and then use the UITapGestureRecognizer inside of your UIImageView subclass like this:

UITapGestureRecognizer *stap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleFingerTapTriggerLock:)];
[stap setNumberOfTapsRequired:1];
[stap setNumberOfTouchesRequired:1];
[stap setDelegate:self];

Then you can perform whatever operation you would like in the method called by the tap gesture recognizer on the touch. The purpose of using the gesture recognizer and the UIView subclass is that it would allow you more flexibility in which touch operations you wanted to handle, you could do different things on multiple taps, long presses, etc...

You could also draw the sign post using CoreGraphics, that would look better but be a lot more work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜