2014-03-05 2 views
6

UIView에 UIAlertView가 있습니다. 로그인 오류가 발생하면 경고보기가 나타납니다.경고보기 위치가 가운데가 아닙니다.

때로는이 그림 다음의 중앙 위치에서 작동했습니다.

enter image description here

내 코드

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Login Failed" message:exceptionString delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 
[alert show]; 

하지만 언젠가는이 그림 다음 왼쪽 위치에서 일했다.

enter image description here

나는 센터 위치에서만합니다.

문제를 해결하는 방법. 고맙습니다.

+1

내가 같은 코드 ... UIAlertView * 경고 = [[UIAlertView ALLOC] initWithTitle를 사용하여 관련 코드 – codercat

+0

를 게시 : nil]; [경고 표시]; –

+0

alertView에 대한 프레임을 설정 했습니까? –

답변

1

경고보기를 어떻게 표시합니까? 이 스타일의 프레임을 initWithFrame으로 설정하고 있습니까?

다음과 같아야합니다. 당신이 UIAlertView를 여러 번 호출 할 때

NSString *exceptionString = "something"; // where ever you get you failed message. 

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Login Failed" message:exceptionString delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 

[alert show]; 
+0

나는이 코드를 사용하지만이 문제가 발생한다. –

+0

경고보기를 전환 할 수있는 다른 코드가 있습니까? 경고에 대한 변환? 시뮬레이터와 장치 또는 시뮬레이터에서 이러한 현상이 발생합니까? –

+0

멍청하다면 그렇게 두어야합니다. 나는 이미 나가있다. – DCMaxxx

0

당신은 내가 전에 본 한

alert.transform = CGAffineTransformMakeTranslation(x, y); 
0

@NatthawatSudsang 변환을 사용하는 경우이 월 일 수있다, 그것은 발생합니다. "OK"otherButtonTitles @ : @ "로그인 실패"메시지 : exceptionString 대표 : cancelButtonTitle 전무

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Login Failed" 
               message:exceptionString 
               delegate:nil 
             cancelButtonTitle:@"OK" 
             otherButtonTitles: nil]; 
[alert show]; 

//then some code 
//more code 

[alert show]; 
관련 문제