设置textview背景色为透明

UITextView *textView=[[UITextView alloc]initWithFrame:CGRectMake(20, 40, 150, 170)];//初始化并设置大小

    textView.text= [ModelDataAll dataDetailFromModel:poet_list andDataNum:a andNSString:xiao_zhuan];///从宏定义中摘取所需要的数据

    textView.backgroundColor=[UIColor colorWithRed:1 green:1 blue:1 alpha:0];//只要alpha=0,前面的浮点数不管是1还是什么。都将变得透明不显示颜色,字体照样现实的

    textView.font=[UIFont systemFontOfSize:12];//设置字体大小

    textView.textAlignment=NSTextAlignmentLeft;///设置字体位置偏左

    [rightView addSubview:textView];

原文地址:https://www.cnblogs.com/OIMM/p/4773392.html