I have recently come across a weird bug in the UITextView by which UIDataDetectorTypeAll does not work on my iPad application until the UITextView is double clicked.
My code is as follows:
- (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];
}
As you can see the UITextView is not set to editable etc, so there should be no issues there. The more peculiar thing is that the iPhone5 and iPhone both detect the data types immediately.
Has anyone come across this, or have any suggestions on how to fix this?
Thanks