Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我UIView有 4 个buttons喜欢animals, birds, nature``fruits. 同时单击其他视图显示所选类别的集合images。我不想在单个视图中执行4 viewsfor 4 按钮?有人能说出这方面的想法吗?
UIView
buttons
animals
birds
nature``fruits
images
views
根据您的要求,您需要一个imageView,然后在每个按钮上单击只需imageView.setBackgroudResource(Your_image_from_drawable);以这种方式调用,您就不需要使用四个 imageView。
imageView
imageView.setBackgroudResource(Your_image_from_drawable);