카테고리 없음
[아이폰] 아이폰 코드-NSArray 사용
행복을전해요
2021. 1. 9. 22:06
juw *가 uiview (또는 uiview 하위 클래스) 인 경우 고유 한 태그 속성을 할당하고 다음과 같이 반복 할 수 있습니다.
for (loop tag condition){
[parentView viewWithTag: tag].alpha = 0;
}
따라서 실제로 항목을 만들고 parentView에 하위보기로 추가 한 후에는 항상 태그를 사용하여 가져올 수 있으므로 항목을 저장할 필요가 없습니다.
-------------------view.subviews에서 모든 객체를 가져와 알파를 0으로 설정하십시오.
예:
for(UIView *v in self.view.subviews) {
if([v isKindOfObject:[UIImageView class]] ) {
v.alpha = 0;
}
}
-------------------// initialize _juwArray array
NSMutableArray *_juwArray = [NSMutableArray arrayWithCapacity:size];
for (NSInteger index = 0; index < size; index++) {
// instantiate _juw instance and add it to _juwArray
// assuming conformation to NSCopying/NSMutableCopying protocols
// or that Juw is a subclass of UIView
[_juwArray addObject:_juw];
}
// set alpha values
for (NSInteger index = 0; index < size; index++) {
[((Juw *)[_juwArray objectAtIndex:index]) setAlpha:0.0];
}
출처
https://stackoverflow.com/questions/2006000