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
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 UIButton
s 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 UIButton
s 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.
精彩评论