SORU
23 EYLÜL 2013, PAZARTESİ


UİTextView iOS7 klipler metin dizesi son satırı

İOS7 içinde UİTextView çok garip olmuştur. Senin gibi altına kaydırın yok senin UİTextView, son satırı giriyoruz yazın metni neden olur "dedi. kırpılmış HİÇBİR şey clipsToBound özellik ayarı denedim ama yine de metin klipleri.

Ben aramak istemiyorum, "setContentOffset:animasyonlu" çünkü bir: bu çok hacky çözüm.. ikincisi: eğer sürgü orta (dikey) bizim textview, olur neden istenmeyen kaydırma.

İşte ekran görüntüsü.

enter image description here

Herhangi bir yardım büyük mutluluk duyacağız!

Teşekkürler!

CEVAP
9 EKİM 2013, ÇARŞAMBA


Sorun iOS 7 kaynaklanmaktadır. Metin görünümünde temsilci, bu kodu ekleyin:

- (void)textViewDidChange:(UITextView *)textView {
    CGRect line = [textView caretRectForPosition:
        textView.selectedTextRange.start];
    CGFloat overflow = line.origin.y   line.size.height
        - ( textView.contentOffset.y   textView.bounds.size.height
        - textView.contentInset.bottom - textView.contentInset.top );
    if ( overflow > 0 ) {
        // We are at the bottom of the visible text and introduced a line feed, scroll down (iOS 7 does not do it)
        // Scroll caret to visible area
        CGPoint offset = textView.contentOffset;
        offset.y  = overflow   7; // leave 7 pixels margin
        // Cannot animate with setContentOffset:animated: or caret will not appear
        [UIView animateWithDuration:.2 animations:^{
            [textView setContentOffset:offset];
        }];
    }
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Gan Eden Productions

    Gan Eden Pro

    11 HAZİRAN 2011
  • Nightmare2005

    Nightmare200

    14 Ocak 2007
  • sWooZie

    sWooZie

    9 ŞUBAT 2006