我正在尝试使用基于textview内容的textview获取动态tableviewcell。它确实扩展并完成工作,但是当我滚动时,检测结束,textview的字体颜色采用色调颜色的颜色.PFB代码和屏幕截图。
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
#import <UIKit/UIKit.h>
@interface CustomCellTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UITextView *cutomTextview;
@property (weak, nonatomic) IBOutlet UITextView *header;
@end
答案 0 :(得分:1)
它正在更改字体颜色,因为您已启用“检测:链接,电话号码”。
您可以从故事板中取消选择,或者您可以将UITextview的色调颜色更改为其他颜色(blackColor)。