CGAffineTransformTranslate не работает в iOS 3.1.3


Я пытаюсь переместить UIAlertView из его положения по умолчанию в центре экрана, вверх до верха. Я использую код ниже, и он работает на iOS 4, но он не переходит на 3.
У кого-нибудь есть идеи?

UIAlertView * newSubscriptionAlertView = [[UIAlertView alloc] initWithTitle: @ "Ndrysho abonimin" message: @ "" делегат:self cancelButtonTitle:@"Anullo" otherButtonTitles:@"Ruaj", nil];
    subscriptionNameField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 22.0)];
    subscriptionNameField.text = [[subscription objectAtIndex:changeCode] title];
    subscriptionNameField.autocorrectionType = UITextAutocorrectionTypeNo;
    subscriptionNameField.autocapitalizationType = UITextAutocapitalizationTypeNone;
    [subscriptionNameField setBackgroundColor:[UIColor whiteColor]];
    [newSubscriptionAlertView addSubview:subscriptionNameField];
    [subscriptionNameField intoFirstResponder];
    [subscriptionNameField release];
    CGAffineTransform moveUp = CGAffineTransformTranslate(newSubscriptionAlertView.transform, 0.0, 0.0);
    [newSubscriptionAlertView setTransform:moveUp];
    [newSubscriptionAlertView show];
    [выпуск newSubscriptionAlertView];

1 ответ

Решение

Решение заключается в следующем:

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);
    }
Другие вопросы по тегам