objective-c - iOS上ScrollView上的Button问题
PHP中文网
PHP中文网 2017-04-18 09:22:44
0
2
237

button添加到ScrollView上,点击效果没了。
通过设置ScrollView.delaysContentTouches = NO;
点击效果回来了,但是button区域的滑动ScrollView失效。
因为button较多所以设置上面的那个不行 有没有好的解决办法。

PHP中文网
PHP中文网

认证高级PHP讲师

membalas semua(2)
黄舟

1. Tentukan kelas UIScrollView dan tulis semula kaedah berikut

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [[self nextResponder] touchesBegan:touches withEvent:event];
    [super touchesBegan:touches withEvent:event];
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    [[self nextResponder] touchesMoved:touches withEvent:event];
    [super touchesMoved:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [[self nextResponder] touchesEnded:touches withEvent:event];
    [super touchesEnded:touches withEvent:event];
}

Dengan cara ini, anda boleh mendapatkan acara klik butang Secara khusus, saya akan memberi anda pautan dan lihat
Perihalan pautan

Peter_Zhu

Bolehkah anda meletakkan pandangan pada scrollView

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!