How to add image as button in objective c?

10,232

You can disable the highlighting effect by using

self.tutorialButton.adjustsImageWhenHighlighted = NO;
Share:
10,232
Vannian
Author by

Vannian

Student

Updated on June 04, 2022

Comments

  • Vannian
    Vannian almost 2 years

    I want to add image as button, and when it is clicked it should open a new view controller... Does anyone know how to do?

    I created a button and added image, but its not nice, because when I click on the image it animates a square arround the image, which I do not want. This what I did.

    - (void)setTutorialButtonImage
    {
        [self.tutorialButton setImage:[UIImage imageNamed:@"app_logo.png"] forState:UIControlStateNormal];
    }
    

    Does any one know how to do... just an image and when I click on it start a new controller

    • CainaSouza
      CainaSouza about 11 years
      It's the way you did... How was the button presented? Did you set it as UIButtonTypeCUstom?
    • Fonix
      Fonix about 11 years
      you could just put an image with a blank button above it
    • iiFreeman
      iiFreeman about 11 years
      just do UIButton with custom style, do set adjustsImageWhenHighlighted to NO and maybe use touch down control event instead of touch up