UIAlertController/UIAlertView scrolling on iOS 8

前端 未结 5 951
旧巷少年郎
旧巷少年郎 2020-12-31 16:41

I\'m wondering if anyone knows a good solution to the fact that UIAlertViews and UIAlertControllers won\'t scroll on iOS 8? Here is an example:

[[[UIAlertVie         


        
5条回答
  •  一生所求
    2020-12-31 17:17

    Use this :

    NSString *message = @"YOUR LONG MESSAGE" ;    
    NSInteger lines = [[message componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] count];
    
        UITextView *txtView = nil ;
        if (lines > MAX_LINES_TO_SHOW)
        {
            txtView = [[UITextView alloc] init];
            [txtView setBackgroundColor:[UIColor clearColor]];
            [txtView setTextAlignment:NSTextAlignmentCenter] ;
            [txtView setEditable:NO];
            [txtView setText:message];
        }
    
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] ;
        [alert setValue:txtView forKey:@"accessoryView"];
        [alert setTag:tag] ;
        [alert show] ;
    

提交回复
热议问题