这是我的代码
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Added to Cart" message:@"Some items are added for time being!" delegate:self cancelButtonTitle:@"View Cart" otherButtonTitles:@"Continue \n Shopping", nil];
alert.tag = 20;
[alert show];
最佳答案
我为您提供了手动解决方案。但我认为这不是一个好的解决方案:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Added to Cart" message:@"Some items are added for time being!" delegate:self cancelButtonTitle:@"View Cart" otherButtonTitles:@"", nil];
UILabel *buttonTitle = [[UILabel alloc] initWithFrame:CGRectMake(148, 102, 125, 40)];
buttonTitle.text = @"Continue Shopping";
buttonTitle.font = [UIFont boldSystemFontOfSize:15];
buttonTitle.textColor = [UIColor whiteColor];
buttonTitle.textAlignment = UITextAlignmentCenter;
buttonTitle.backgroundColor = [UIColor clearColor];
buttonTitle.numberOfLines = 2;
[alert addSubview:buttonTitle];
alert.tag = 20;
[buttonTitle release];
[alert show];
无论如何你都可以使用它......
关于iphone - 如何使用 UIAlertView 生成多行而不是单行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10735703/