我最近在UITextView中遇到了一个奇怪的错误,在双击UITextView之前,UIDataDetectorTypeAll不能在我的iPad应用程序上运行。
我的代码如下:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[self setTitle:@"How To Use"];
UITextView *textV1 = [[UITextView alloc] initWithFrame:self.vPlaceholder.frame];
if (IS_IPHONE_5)
{
[textV1 setContentSize:CGSizeMake(self.vPlaceholder.frame.size.width, 800)];
[textV1 setFont:[UIFont systemFontOfSize:14.0f]];
}
else if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
[textV1 setContentSize:CGSizeMake(self.vPlaceholder.frame.size.width, 700)];
[textV1 setFont:[UIFont systemFontOfSize:14.0f]];
}
else
{
[textV1 setContentSize:CGSizeMake(self.vPlaceholder.frame.size.width, self.vPlaceholder.frame.size.height)];
[textV1 setFont:[UIFont systemFontOfSize:24.0f]];
}
[textV1 setText:@"The ShoreUpdate App allows you to locate, record and submit information about archaeological sites at risk from coastal erosion. There are three main options from the home screen: \n \nShoreUpdate Map - This screen displays over 12,000 coastal archaeological sites as clustered points. Locate sites by zooming into clusters to reveal the details and recording forms of individual sites. if you have obtained the Site ID from the SCH@RP website you can also type the ID into the search bar. You can then choose to record the condition of the site by completing the form directly, or by downloading the form to your device for later us (this also means you are not dependent on a phone signal when on location). \n \nDownloaded Forms - This screen displays any forms that you have previously downloaded. Or, if you know the Site ID / Name, you can search for it using the bar at the top to access the form. You can also use this screen to submit your completed forms by selecting the Upload option. \n \nAdd Heritage Site - This screen enables you to records and submit a new site to the SCH@RP website. \n \nFeel free to email any comments or issues to info@wildknowledge.co.uk \n \nWatch our video tutorial at http://www.youtube.com/watch?v=PILS_Sl3SVQ"];
[textV1 setEditable:NO];
[textV1 setBackgroundColor:kBlueColor];
[textV1 setTextColor:[UIColor whiteColor]];
[textV1 setScrollEnabled:YES];
[textV1 setUserInteractionEnabled:YES];
textV1.dataDetectorTypes = UIDataDetectorTypeAll;
[self.view addSubview:textV1];
}
正如您所看到的,UITextView未设置为可编辑等,因此应该没有问题。更奇怪的是,iPhone5和iPhone都会立即检测数据类型。
是否有人遇到此问题,或者对如何解决此问题有任何建议?
由于