2011-01-24 19 views
0


私はUIAlertViewを画面中央のデフォルト位置から上に移動しようとしています。下記のコードを使用していますが、iOS 4でも動作しますが、3では動きません。
誰もが考えていますか?CGAffineTransformTranslateが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

私はあなたが起こることを期待知っているが、 'CGAffineTransformTranslate(someTransform、0、0)'戻ったばかりの 'someTransform'を返すために起こっているはありません君は。 –

+0

です。そのため、setTransformメソッドが1行下で使用されています。私はそれがiOS 4.0+で動作するので、構文は大丈夫だと思います。 – Olsi

+0

このようにしても、newSubscriptionAlertView.transform = CGAffineTransformTranslate(newSubscriptionAlertView.transform、0.0、0.0);私は同じ問題を抱えています。それは4で動作しますが、3では動作しません:( – Olsi

答えて

0

解決策はこれです:

 
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); 
    } 
関連する問題