3

我最近在 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 都能立即检测到数据类型。

有没有人遇到过这个问题,或者对如何解决这个问题有任何建议?

谢谢

4

0 回答 0