我有不同对象的数组,例如:UISegmentedControl、UILabel 等。
如果我使用“objectAtIndex”,如何获取对象类型(类)?
我试着这样做:
//while my object count ok
while (i< [allChandeableSubview count]) {
id random = [allChandeableSubview objectAtIndex:i];
if([random isKindOfClass:[UISegmentedControl class]]){
UISegmentedControl *newSegment = [[UISegmentedControl alloc]init];
newSegment = random;
newSegment.selectedSegmentIndex = 0;
}
i++;
}
但我认为这是错误的。请帮帮我!