2

I want to create a new Control which is the combination of two UIImageViews and one UILabel. I need to implement TouchUpInsite and LongPress event for the entire Control. I mean the action would perform for any UIImageView or UILabel in the entire Control.

So, how to create this Control in objective-c and reuse it like other default Controls in iOS?

Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114
  • What have your tried? There seems to me that you have put any effort in solving this yourself. There are many tutorial on how to create custom controls online. – rckoenes Jan 09 '16 at 14:38
  • I have seen Tutorials, where they are Creating Custom Classes and assigning these Classes to the Control. But, I want to use the Control as a plugin, by which I can use the Customized Control in any project. – D. Venkata Naresh Jan 09 '16 at 14:42
  • Still the same logic applies, you create your own control that inherits from `UIControl`. The amount of customization is up to you, the more properties you add the more it can be customized. – rckoenes Jan 09 '16 at 14:45
  • How to make that Control accessed from Object library? – D. Venkata Naresh Jan 09 '16 at 14:50
  • You can't, please see this answer: http://stackoverflow.com/questions/494520/how-do-you-display-custom-uiviews-in-interfacebuilder – rckoenes Jan 09 '16 at 14:54
  • Also have look [`IBInspectable`/`IBDesignable`](http://nshipster.com/ibinspectable-ibdesignable/) – rckoenes Jan 09 '16 at 15:37

1 Answers1

0

You can Create a View of type UICONTRol and add image and label as subview.

You can take IBACTION of this view and do what ever you want to do on touch up inside.

Chirag kukreja
  • 433
  • 2
  • 5
  • As I mentioned in comment, How to make that Control accessed from Object library? I studied somewhere we can create plugins before XCode-4. But now, I didn't find that feature. – D. Venkata Naresh Jan 11 '16 at 03:44