문제

I'm creating an iOS user interface with a lot of different UIImageViews that will trigger actions when tapped (once is enough). I have the choice between using UIButtons with a custom view (the image) or just setting up a bunch of UIImageviews with an associated UITapGestureRecognizers. In terms of functionality I get the same expected result (action triggered on tap). My question is more about performance: the app will (lazily) load around 300 of these touchable UIImageViews in a scroll view. In terms of memory allocation which technique would you suggest?

Thanks for any help and guidance!

도움이 되었습니까?

해결책

UIButtons. They were designed for this and have been extensively optimized by Apple for [touches]. If you might need more advanced functionality in the future, you might use a UIImageView subclass w/ UITouch events. Good luck!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top