0
我正在添加一个自定义的提醒视图,并希望将其颜色更改为带有textview的黄色。为此,我们传递透明图像的名称那颜色和警报挑选了color.Also我想提高警觉的大小动态地根据文本中的TextView 任何帮助,将不胜感激自定义提醒颜色,并根据文本输入增加其框架
感谢 维卡斯
我正在添加一个自定义的提醒视图,并希望将其颜色更改为带有textview的黄色。为此,我们传递透明图像的名称那颜色和警报挑选了color.Also我想提高警觉的大小动态地根据文本中的TextView 任何帮助,将不胜感激自定义提醒颜色,并根据文本输入增加其框架
感谢 维卡斯
改变颜色与下面的代码。但如何解除警报
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlert View" message:@"hello" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Close",nil];
UIImage *alertImage = [UIImage imageNamed:@"plus.png"];
UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:alertImage];
backgroundImageView.frame = CGRectMake(0, 0, 282, 130);
backgroundImageView.contentMode = UIViewContentModeScaleToFill;
[alert addSubview:backgroundImageView];
[alert sendSubviewToBack:backgroundImageView];
[alert show];
[alert release];
you can use this code to customize your uialertview..
You can take out the subviews of uialertview and can customize it any way you want.
Here is the code I used to customize the uialertivew
==========
-(void)willPresentAlertView:(UIAlertView *)alertView{
for(UIView *view in alertView.subviews){
view.backgroundColor= [UIColor clearColor];
}
UILabel *title = [alertView valueForKey:@"_titleLabel"];
title.font = [UIFont fontWithName:@"Gibson-Regular" size:15.0];
[title setTextColor:[UIColor whiteColor]];// set title color and font
UILabel *body = [alertView valueForKey:@"_bodyTextLabel"];
body.font = [UIFont fontWithName:@"Gibson-Regular" size:15.0];
[body setTextColor:[UIColor whiteColor]];//set body color and font
//after giving 12345 tag to your alert
UITextView *txtBody=(UITextView*)[alertView viewWithTag:12345];
if(txtBody){//scrollable
txtBody.scrollEnabled = NO;
CGRect frame = txtBody.frame;
frame.origin = CGPointMake(0, 0);
UITextView *txtView = [[UITextView alloc]initWithFrame:frame];
txtView.editable = NO;
txtView.text = txtBody.text;
txtView.font = [UIFont fontWithName:@"Gibson-Regular" size:15.0];
[txtView setTextColor:[UIColor whiteColor]];
[txtBody addSubview:txtView];
[email protected]"";
}
NSLog(@"%@",txtBody.subviews);
for(UIView *view in txtBody.subviews){
view.backgroundColor= [UIColor clearColor];
}
// alertView.backgroundColor=[UIColor redColor];
}