【发布时间】:2013-01-04 18:35:24
【问题描述】:
我有 UISegmentedControl 对象,我在其中获取了图像数组。现在我想在选择每个对象(如 UIButton 控件)后更改这些图像,我们可以在其中设置图像以供选择和非选择。 这是我的代码
NSArray *itemArray;
itemArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"grey.png"],
[UIImage imageNamed:@"overlay.png"],
[UIImage imageNamed:@"marker.png"],
nil];
segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
[segmentedControl addTarget:self action:@selector(segmentedControlIndexChanged) forControlEvents:UIControlEventValueChanged];
【问题讨论】:
标签: ios image nsarray uisegmentedcontrol