CGAffineTransformTranslate not working in iOS 3.1.3

755 Views Asked by At


I'm trying to move a UIAlertView from it's default position in the center of the screen, up to the top. I'm using the code below and it works on iOS 4, but it doesnt move on 3.
Anyone has any idea?

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];
1

There are 1 best solutions below

0
On BEST ANSWER

The solution is this:

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);
    }