0

I need to do the following tasks with my UIImageView.

  1. Highlight the UIImageView on click .
  2. Create a clear button on right side of UIImageView.
  3. Clear the UIImageView on the created clear button click.
  4. Set image named as myimage.png in UIImageView which is cleared before.

Can any one help me to do it?any sample codes,apps or links to refer?

EmptyStack
  • 51,274
  • 23
  • 147
  • 178
Vipin
  • 4,718
  • 12
  • 54
  • 81
  • Highlight imageView on click of what? – Nitish Jun 08 '11 at 12:52
  • when i am clicking the image view,i need to highlight it – Vipin Jun 08 '11 at 13:01
  • Do you know how to work with view, button, image etc. in iPhone? It is not very clear what you are asking, or what is the problem actually. – taskinoor Jun 08 '11 at 13:01
  • i need to create highlighted image view with a delete button.delete button(cross symbol) must be in image view as same as we are deleting images in iphone or ipad – Vipin Jun 08 '11 at 13:14

2 Answers2

0

If you are using IB, you can set the highlighted state of the image. Go to the attributes inspector, its the 4th option on the right pane. Set the 'highlighted' drop down to myImage.png after copying the image into resources folder in your project.

Also, make sure the checkbox for Interaction is enabled (to user interaction enabled).

Now, add a tap gesture recognizer from the Objects menu in the bottom. Add it to the UIImageView you want. Connect the selector of the tap gesture recognizer (from the last option in the right pane or by right clicking on the tap gesture recognizer) to an IBAction to handle the tap gesture recognizer.

In that action, you can do whatever you want. Like setting a clear button etc. You can set the imageview to highlighted using this..

self.myImageView.highlighted = YES;

Shwethascar
  • 1,142
  • 9
  • 18
0

for highlighting place the imageView above a UIView,but not inside it[i.e put them both on a common super view] (with a frame 2-3 pix greater than imageView) with backgroundColor as the color of ur highlight to be .. set it hidden

create button (I hope u know how to create that) and add it to the imageView. In the button click method set that imageView.image = nil

add a tapGestureRecogniser to the imageView and in the the method set the myView.hidden = NO

Community
  • 1
  • 1
Amit Singh
  • 8,383
  • 4
  • 28
  • 31