how to create a IB action for a image view - iphone

i have a image ,i want to launch url when i press that logo or image ,how to implement ib action for that image view ...
can any one give suggestion i selected image view in ib to place my logo is it right?

UIImageView is not a subclass of UIControl so it doesn't support the target-action mechanism. You have 2 options:
Use a UIButton instead (and set your image as the button's background image).
Set userInteractionEnabled = YES; on your image view and implement the touch handling in -touchesMoved:` etc. yourself.

Related

Adding Background Image to FlowCover

I'm using FlowCover in an app and need to add a background, but inserting a UIImageView and sending to the back in .xib only gives me the background image and buttons and no coverflow animation. I also cannot see where i would programme a
self.backgroundColor = [[UIColor alloc]initWithPatternImage:[UIImage imageNamed:#"bground.png"]];
type thing in the implemetation.
Any clues?
It does appear that you can add an UIImageview to the ViewController's View in the MainWindow.nib:
In the editor dropdown you can send the image to the back. It means that the Flow Cover View MUST NOT be set to Opaque and then will sit on top of the ImageView.

how to make a custom viewController with transparent black background?

I'm trying to make a viewController appears like the small one in the middle of the picture :
I tried with the UiAlertView, but it semms not offering this feature.
I found some apps adding buttons and labels, photo in similar viewControllers.
Any idea ?
It's not a view controller - it looks like a view that is added as a subview.
The middle View in the image is not a viewcontroller. It is just a custom UIView made up using images and buttons. You can set the transparency of a UIView using property alpha.
Example
yourview.alpha = 0.5;

Tasks with my UIImageView

I need to do the following tasks with my UIImageView.
Highlight the UIImageView on click .
Create a clear button on right side of UIImageView.
Clear the UIImageView on the created clear button click.
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?
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
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;

iPhone Setting A Background Image

I want to use an image as a background for my application. I want the buttons to be over the image. How is this accomplished? Everytime I use image view it covers up the buttons.
The image view should cover your buttons unless you are placing it higher in the list of subviews. Make sure your image view subview is added first and the buttons (and all other views) will be displayed on top of it.
Are you doing this in Interface Builder or manually in code?
You could try using UIView's sendSubviewToBack method:
UIImageView view = / init view */;
// some additional code here
mainView.addSubview(view);
// add buttons, etc...
mainView.sendSubviewToBack(view);

UIButton doesn't appear on UIToolbar

I have a UIToolbar where I have dragged a UIButton. When I set the button properties to Custom, and assign an image (or background image) the graphics don't appear. However, when I give it a custom text, the text will appear. Why is it that the images don't appear?
Are you sure the image is present in your bundle/project?
Are you setting the button's image for UIControlStateNormal?