0


UIAlertView を画面中央のデフォルト位置から上に移動しようとしています。以下のコードを使用していますが、iOS 4 では動作しますが、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 リリース];
    CGAffineTransform moveUp = CGAffineTransformTranslate(newSubscriptionAlertView.transform, 0.0, 0.0);
    [newSubscriptionAlertView setTransform:moveUp];
    [newSubscriptionAlertView ショー];
    [newSubscriptionAlertView リリース];
4

1 に答える 1

0

解決策は次のとおりです。

if (!([[[UIDevice currentDevice] systemVersion] floatValue] > 4.0)) {
//これは iOS バージョン 4.0 未満の場合です
        changeFolderAlertView.transform = CGAffineTransformMakeTranslation(0.0f, 70.0f);
    } そうしないと {
//これはiOS4.0+用です
        changeFolderAlertView.transform = CGAffineTransformMakeTranslation(0.0f, 0.0f);
    }
于 2011-01-25T14:09:15.807 に答える