2011-01-24 4 views
0


UIAlertView를 화면 중앙의 기본 위치에서 맨 위로 이동하려고합니다. 나는 아래의 코드를 사용하고 있으며 iOS 4에서 작동하지만 3으로 이동하지는 않습니다.
누구든지 어떤 생각을 가지고 있습니까?CIAffineTransformTranslate가 iOS 3.1.3에서 작동하지 않습니다.

 
UIAlertView *newSubscriptionAlertView = [[UIAlertView alloc] initWithTitle:@"Ndrysho abonimin" message:@" " delegate:self cancelButtonTitle:@"Anullo" otherButtonTitles:@"Ruaj", nil]; 
    subscriptionNameField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 22.0)]; 
    subscriptionNameField.text = [[subscriptions objectAtIndex:changeCode] title]; 
    subscriptionNameField.autocorrectionType = UITextAutocorrectionTypeNo; 
    subscriptionNameField.autocapitalizationType = UITextAutocapitalizationTypeNone; 
    [subscriptionNameField setBackgroundColor:[UIColor whiteColor]]; 
    [newSubscriptionAlertView addSubview:subscriptionNameField]; 
    [subscriptionNameField becomeFirstResponder]; 
    [subscriptionNameField release]; 
    CGAffineTransform moveUp = CGAffineTransformTranslate(newSubscriptionAlertView.transform, 0.0, 0.0); 
    [newSubscriptionAlertView setTransform:moveUp]; 
    [newSubscriptionAlertView show]; 
    [newSubscriptionAlertView release]; 
+0

(someTransform, 0, 0)'단지로 다시'돌아 someTransform' 것입니다 당신. –

+0

이고 setTransform 메서드가 아래 한 행에 사용되는 이유입니다. 나는 iOS 4.0 이상에서 작동하기 때문에 문법은 괜찮다고 생각한다. – Olsi

+0

비록 내가 이렇게하면 : newSubscriptionAlertView.transform = CGAffineTransformTranslate (newSubscriptionAlertView.transform, 0.0, 0.0); 나는 같은 문제를 가지고있다. 의미는 4에서 작동하지만 3에서 작동하지 않습니다. ( – Olsi

답변

0

해결책은 이것이다 : 나는`CGAffineTransformTranslate 당신이 일이 기대하는 것을 알고 있지만하지 않는

 
if (!([[[UIDevice currentDevice] systemVersion] floatValue] > 4.0)) { 
//This is for iOS versions below 4.0 
     changeFolderAlertView.transform = CGAffineTransformMakeTranslation(0.0f, 70.0f); 
    } else { 
//This is for iOS4.0+ 
     changeFolderAlertView.transform = CGAffineTransformMakeTranslation(0.0f, 0.0f); 
    } 
관련 문제