카테고리 없음

[iOS] UIButton 및 더 작은 태그가있는 태그를 가져옵니다.

행복을전해요 2021. 2. 6. 13:33

필요한 것은 다음 viewWithTag:과 같습니다.

-(void)touchButton:(id)sender {

   UIButton *buttonSender = sender;
      buttonSender.selected = YES;
         NSLog(@"button tag %@",buttonSender.tag);
         
            for (int i = buttonSender.tag-1; i>0; i--) {
            
                  NSLog(@"int = %d",i); 
                        //for example if buttonSender.tag is 4, in this way i have 3,2,1
                        
                              /* Add this line */
                                    UIButton *tempButton = (UIButton *)[scrollView viewWithTag:i];
                                       }
                                       }
                                       


출처
https://stackoverflow.com/questions/22050190