[英]UItextView font color is changing automatically to the tint color
I am trying to get dynamic tableviewcell with a textview based on textview's content. 我正在尝试基于textview的内容获取带有textview的动态tableviewcell。 It does expand and does the job, but when I scroll, the detection goes off and the font color of the textview takes the color of the tint color.PFB the code and screenshots. 它确实可以扩展并完成工作,但是当我滚动时,检测将关闭,并且textview的字体颜色将变为色调颜色。PFB代码和屏幕截图。
ViewController.m ViewController.m
#import "ViewController.h"
#import "CustomCellTableViewCell.h"
@interface ViewController ()
@property(nonatomic, strong)NSArray *data;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.data = [NSArray arrayWithObjects:@"ONe is here wihth some thins www.google.com",@"Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com",@"ONe is here wihth some thins www.google.com",@"Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com",@"ONe is here wihth some thins www.google.com",@"Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com,Two with soe phone numbers like 002-092-98-283 and link http://google.com", nil];
// self.tableView.estimatedRowHeight = 100;
self.tableView.rowHeight = UITableViewAutomaticDimension;
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.data count];
}
// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellID = @"CustomCell";
CustomCellTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (!cell) {
cell = [[CustomCellTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
cell.header.text = @"This is a header";
cell.cutomTextview.text = [self.data objectAtIndex:indexPath.row];
return cell;
}
@end
CustomTableViewcell.h CustomTableViewcell.h
#import <UIKit/UIKit.h>
@interface CustomCellTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UITextView *cutomTextview;
@property (weak, nonatomic) IBOutlet UITextView *header;
@end
It is changing font color because you have enabled ` Detection : Links , Phone Number '. 因为启用了“ 检测:链接,电话号码 ” ,所以它正在更改字体颜色。
You can de-select from Storyboard or you can change tint color of UITextview to some other color (blackColor). 您可以从情节提要中取消选择,也可以将UITextview的颜色更改为其他颜色(blackColor)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.