Si Te Feng
Si Te Feng

Reputation: 190

Storyboard Layout for UITableViewCell issue

Currently I'm trying to create storyboard layout for a UITableViewCell with picture shown below. The blue views are UIButtons while the green views are UIImageViews.

The layout for blue buttons was okay, with an "align to horizontal center in container" , a few "equal width", and some other constraints. But I'm not sure what constraints to put on the image views so that they can be aligned correctly. The desired outcome is the widths of the buttons shrink on smaller devices, and the image views are always centered on the buttons.

I tried dragging the image view inside the buttons, but storyboard doesn't allow that.

enter image description here

Upvotes: 0

Views: 67

Answers (1)

Wain
Wain

Reputation: 119031

They don't need to be subviews, just ordered in the superview so they are in front of the buttons. Though you might actually want to use transparent buttons over a container view with your background colour and both the image view and button as subviews (to avoid potential touch issues and separate styling from though area).

Pin the width of the image views and then center each in its respective button (X and Y).

Upvotes: 1

Related Questions