我是Swift和iOS的新手.在Android中,我们可以轻松地拉伸图像并将一些内容放在此图像中,但我找不到iOS的任何等效内容.
我用resizableImage(withCapInsets)方法找到了很多教程/帖子,但它并不是我想要的.看这个图像:

区域2,4,5,6和8将被拉伸并且仅被拉伸.使用Android 9补丁,我可以定义多个可伸缩区域,如下所示:

在这里,只有红色区域是可拉伸的.此方法对于保持绿色区域固定非常有用,但resizableImage(withCapInsets)是不可能的.
此外,使用Android 9补丁,我们可以在蓝色区域轻松定义内容区域,如texview,imageview,...,图像根据此区域中的文本大小进行拉伸.iOS和Swift有可能吗?
我在我的应用程序上添加了新的 Splashscreen API (androidx.core:core-splashscreen:1.0.0-rc01),之后我的边距/填充被破坏,但仅适用于我的启动器活动 (MainActivity),特别是从此活动打开的对话框片段。在其他活动中,没问题,一切正常。
下面是我的对话框片段,没有实现启动画面,我的填充/边距都正常:

现在有了 Splashscreen 实现:
[
我按照开发人员 Android 文档的说明进行操作:https ://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen
在我的 MainActivy.kt 中
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
Run Code Online (Sandbox Code Playgroud)
在 Manifest.xml 中,我在 MainActity 中添加了以下代码
android:theme="@style/AppTheme.AppStarting"
Run Code Online (Sandbox Code Playgroud)
在我的 Splashscreen 主题中,我已将“postSplashScreenTheme”设置为我的原始主题
<style name="AppTheme.AppStarting" parent="Theme.SplashScreen">
<item name="postSplashScreenTheme">@style/AppTheme</item>
<item name="windowSplashScreenBackground">@color/white</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher_foreground</item>
</style>
Run Code Online (Sandbox Code Playgroud)
最后,我的对话框片段是在我的应用程序中随处使用的相同 XML,并在relativelayout 中进行填充:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
Run Code Online (Sandbox Code Playgroud)
此问题仅适用于 MainActivity 中的 DialogFragment 或 AlertDialog,其他组件或其他活动中的 DialogFragment 没有问题...有什么想法吗?