Is there any way to find out in code name of image was used in XIB for eg background for a button?
Let say I have xib with button which has property Background (for State Config: Default) set as "button.png", button has an IBOutlet eg myButton. When my view is created from xib I can easily access image by: [myButton backgroundImageForState:UIControlStateNormal] but it's of course UIImage, but I need to find name of image ("button.png") was used in xib.
I've tried to subclass UIButton and find something with NSCoder inside initWithCoder:(NSCoder *)aDecoder but without results
Part of xib where button's background is defined is
<object class="NSCustomResource" key="IBUINormalBackgroundImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button.png</string>
</object>
was trying something like:
NSObject * obj = [aDecoder decodeObjectForKey:@"IBUINormalBackgroundImage"];
but doesn't work (how to get use of NSCoder when initializing from nib?)
Also was trying to override
-(void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state{
[super setBackgroundImage:image forState:state];
}
But is never called, however in awakeFromNib everyting is already initialized and loaded.
Can anyone explain / help with this, please?