17 #import "NIButtonUtilities.h"
20 IMP method = [target methodForSelector:selector];
23 image = method(target, selector, UIControlStateNormal);
24 [button setImage:image forState:UIControlStateNormal];
26 image = method(target, selector, UIControlStateHighlighted);
27 [button setImage:image forState:UIControlStateHighlighted];
29 image = method(target, selector, UIControlStateDisabled);
30 [button setImage:image forState:UIControlStateDisabled];
32 image = method(target, selector, UIControlStateSelected);
33 [button setImage:image forState:UIControlStateSelected];
35 UIControlState selectedHighlightState = UIControlStateSelected | UIControlStateHighlighted;
36 image = method(target, selector, selectedHighlightState);
37 [button setImage:image forState:selectedHighlightState];
41 IMP method = [target methodForSelector:selector];
44 image = method(target, selector, UIControlStateNormal);
45 [button setBackgroundImage:image forState:UIControlStateNormal];
47 image = method(target, selector, UIControlStateHighlighted);
48 [button setBackgroundImage:image forState:UIControlStateHighlighted];
50 image = method(target, selector, UIControlStateDisabled);
51 [button setBackgroundImage:image forState:UIControlStateDisabled];
53 image = method(target, selector, UIControlStateSelected);
54 [button setBackgroundImage:image forState:UIControlStateSelected];
56 UIControlState selectedHighlightState = UIControlStateSelected | UIControlStateHighlighted;
57 image = method(target, selector, selectedHighlightState);
58 [button setBackgroundImage:image forState:selectedHighlightState];
62 IMP method = [target methodForSelector:selector];
65 color = method(target, selector, UIControlStateNormal);
66 [button setTitleColor:color forState:UIControlStateNormal];
68 color = method(target, selector, UIControlStateHighlighted);
69 [button setTitleColor:color forState:UIControlStateHighlighted];
71 color = method(target, selector, UIControlStateDisabled);
72 [button setTitleColor:color forState:UIControlStateDisabled];
74 color = method(target, selector, UIControlStateSelected);
75 [button setTitleColor:color forState:UIControlStateSelected];
77 UIControlState selectedHighlightState = UIControlStateSelected | UIControlStateHighlighted;
78 color = method(target, selector, selectedHighlightState);
79 [button setTitleColor:color forState:selectedHighlightState];