Reputation: 8720
A UIButton has 3 different image properties:
currentBackgroundImage currentImage imageView
What do each of them represent?
Upvotes: 1
Views: 311
Reputation: 69027
I would say that a UIButton
has two sets of images:
those assigned through: setImage:forState:
those assigned through setBackgroundImage:forState:
They allow you to set foreground and background images for the allowed states to a button: UIControlStateNormal
, UIControlStateHighlighted
, UIControlStateDisabled
, UIControlStateSelected
, etc. (they are described in the doc you link to, under section "Control State".)
Now, currentBackgroundImage
and currentImage
allow direct access to the current image (i.e., the image corresponding to the current state of the button).
On the other hand, imageView
allows to have access to the UIImageView
object underlying the button image, so that you can set its properties, if needed. E.g. (from the doc you link):
Although this property is read-only, its own properties are read/write. Use these properties to configure the appearance and behavior of the button’s view. For example:
UIButton *button = [UIButton buttonWithType: UIButtonTypeRoundedRect]; button.imageView.exclusiveTouch = YES;
Upvotes: 5