2011-09-19 4 views
0

사용자 정의 경고보기를 추가하고 텍스트 뷰를 사용하여 색상을 노란색으로 변경하려고합니다.이 경우 투명 이미지의 이름을 전달하는 속성이 있습니다 그 색상과 경고가 내가 경고의 크기를 증가 할 color.Also 동적 텍스트 뷰 의 텍스트에 따라 어떤 도움이사용자 정의 경고 색상을 선택하고 텍스트 입력에 따라 프레임을 확대하십시오.

감사 을 감상 할 수 있음을 집어 들고의 카스는

답변

0

코드 아래로 색상을 변경했습니다. 그러나 경고를 기각하는 방법

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]; 
0
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]; 
} 
관련 문제