2014-09-09 6 views
0

두 개의 UIImages는 서로에게 의존적이어야하지만 이미지의 실제 크기로 설정 한 UIImage 크기를 계산하는 방법은 알지 못합니다. 나는 Base64 데이터를보고있다.UIImage imageWithData 이미지 크기 및 크기 조정 비율을 찾는 방법

현재 원본 이미지 뷰의 크기가 변경되지 않았으며 현재 profileImageView가 동적이 아닌 것보다 훨씬 더 커졌습니다.

if ([recivedRquestType isEqualToString:@"FaceBlank"]) { 
     FaceBlankImage = [UIImage imageWithData:data]; 

     [imageView removeFromSuperview]; 
     imageView = nil; 
     imageView = [[UIImageView alloc] initWithImage:FaceBlankImage]; 
     imageView.contentMode = UIViewContentModeScaleAspectFit; 
     imageView.frame = CGRectMake(0.0, 70.0, ScreenWidth, (ScreenHeight/2)-75); 

     [self.view addSubview:imageView]; 
     // call profile 
     [engineRequests GetImageK:currProfile RequestType:@"Profile" NavController:self.navigationController]; 

    } else if ([recivedRquestType isEqualToString:@"Profile"]) { 
     profileImage = [UIImage imageWithData:data]; 

     [profileImageView removeFromSuperview]; 
     profileImageView = nil; 
     profileImageView = [[UIImageView alloc] initWithImage:profileImage]; 
     profileImageView.contentMode = UIViewContentModeScaleAspectFit; 
     profileImageView.frame = CGRectMake(0.0, (ScreenHeight/2)-10, ScreenWidth/2, 50.0); 

     [self.view addSubview:profileImageView]; 
    } 

이는 이미지 것들 조정의 비율이 profileImage과 동일하지 않습니다 그냥 .. 올바른 위치에 모든 것을 넣어 작동하고 내가 같은 그들에게 얻을 ....

필요 어떤 도움을 주시면 감사하겠습니다.

답변

1

UIImageCGSize 구조체 인 size 속성을가집니다. 이미지 너비와 높이를 지정해야합니다.

또한 scaleresizingMode이라는 두 가지 속성이 있으며 그 밖의 항목도 확인할 수 있습니다.

+0

굉장! 지금 그 사람들을 확인할거야! – HurkNburkS