CGAffineTransformTranslate 在 iOS 3.1.3 中不起作用
我正在尝试将 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 release]; CGAffineTransform moveUp = CGAffineTransformTranslate(newSubscriptionAlertView.transform, 0.0, 0.0); [newSubscriptionAlertView setTransform:moveUp]; [newSubscriptionAlertView show]; [newSubscriptionAlertView release];
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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是这样的:
The solution is this: