问题标签 [pure-layout]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ios - Custom UItableViewCell with PureLayout and dynamic number of buttons
I have created a custom UITableViewCell which display dynamic number of buttons in horizontal access using the following initWithStyle
It works well and it display 4 buttons aligned in horizontal access , the problem I'm facing is that I need to make this buttons dynamic depending in data retrieved from API , for example if there are no Facebook link , Cell should display only 3 buttons .... The problem that
is called in initializing the cell before I could configure cell data to determine the true number of buttons and their links.
Could any have suggestion for current situation?
ios - 支持从右到左的纯布局
iOS 纯布局是否支持从右到左的语言?我们如何在阿拉伯语的代码中实现它而不需要去设置和选择区域和格式语言
谢谢
ios - 如何在自定义 UITableViewCell 中使用 PureLayout 显示图像?
我正在 iOS 上创建一个图像投票应用程序。提要将是条目的实例,类似于发布的图像(无边框)。我UITableViewCell使用 PureLayout 创建了一个自定义。但是,图像(异步加载)不显示。
我invalidateIntrinsicContentSize在图像完成处理程序中尝试过类似的东西,但没有奏效。我是 AutoLayout 的新手,我正在关注这个示例代码
这是我对图像和 2 个顶部标签的约束设置
ios - 嵌入视图并调整其大小
我遇到了嵌入式视图和自动布局的问题。
我创建了一个视图,它有点复杂。所以现在我想重构这个视图并创建一些视图组件。我得到了其中一个视图,并将它们放在一个 uiview 类中,并将其所有逻辑都放在那里。让我们将此视图称为 XView。到现在为止还好。
所以我尝试将 XView 嵌入到主视图中,以查看该视图及其新组件的工作原理。我把这个命令:
它不起作用。xViewInstance 比父视图大。我想调整 xViewInstance 的大小。
所以我用谷歌搜索了答案,看看出了什么问题。我找到了一些可以帮助我的答案。我找到了 PureLayout。
所以我尝试了它。
它没有用。xViewInstance 继续大于其父级。
我在堆栈中找到了另一个答案,一个在代码中创建约束的代码,以编程方式调整子视图。再次它没有工作。
现在我不知道会发生什么。我认为这可能是 xViewInstance 约束的一些优先级。
有没有人因这种情况而通过?如果有人能就此提供一些建议,我将不胜感激。
ios - 使用 Pure Layout 时如何实时添加随机视图
我在我的 iOS 应用程序中使用 PureLayout,并按照此处的说明进行操作: https ://github.com/PureLayout/PureLayout/wiki/Tips-and-Tricks 也就是说,使用名为 didSetupConstraints 的标志和方法 updateViewConstraints。但是现在我想在用户按下按钮时在另一个随机视图中添加一个视图。我能想象的唯一方法是创建另一个标志,如 didNewViewSetupConstraints 并在 updateViewConstraints 中创建另一个块,我使用 2 个 UIView 变量在它们之间创建新的约束。那正确吗?因为我认为这只是一件小事(添加子视图及其约束)需要做很多工作。请注意,我无法在不安装约束的情况下创建约束,因为我事先不知道(用户将点击它们)。这就是我评论 RANDOM 的原因。我在示例代码 10 中看到,它使用 autoRemoveConstraints 和 autoInstallConstraints 在两组约束之间切换。因为我的 2 个视图是随机的,我想我不能做这样的事情,这就是我为这两个视图创建一个标志和两个变量以在 updateViewConstraints 中设置约束的原因。但我敢肯定这太过分了。感谢您的任何建议或想法。
ios - 为什么这个视图在与垂直轴对齐时水平居中
好的,所以我是 Swift 编程语言和 IOS 平台的新手,但是我在其他平台(如 Android/WP/Xamarin)上的移动开发方面有很强的背景,所以我决定从 Auto Layout 开始深入学习布局系统。
在这里,我试图通过PureLayout使用 Auto Layout API 将视图水平居中并将其与屏幕底部对齐。当我将视图设置为与其超级视图的水平轴对齐时,这是我得到的结果。
代码
结果
但是,当我将视图设置为与垂直轴对齐时,我得到了所需的最终结果
代码
结果
即使我得到了我想要的结果,如果没有正确理解为什么它通过将视图设置为与它的超级视图的垂直轴对齐来水平对齐,我对继续进行感觉并不好。所以有人可以向我解释对齐轴的整个概念以及它们在自动布局中的工作方式。提前致谢。
ios - 使用 PureLayout 垂直对齐标签
我有一个包含标签的简单 UIView 子类。该子类具有以下 init 方法:
实际上,标签的文本可能会在运行时更改,但无论如何,当我运行应用程序时,我看不到标签在其父视图中垂直居中......有人可以帮我解决这个问题吗?
提前致谢
ios - 无法使用 PureLayout 设置滚动视图
我在子类中有以下viewDidLoad方法实现UIViewController:
但是当我运行应用程序时,内容不会滚动。我发现很少有PureLayout文档和示例,并且对滚动视图一无所知。有人可以帮我解决这个问题吗?
ios - AutoLayout without usage of Storyboards or Interface Builder
I am building an app where I want to completely avoid using Storyboard and Interface Builder in general, so all UI should be specified in code. I am using PureLayout, a nice API for configuring AutoLayout constraints.
However, my issue is that it seems like AutoLayout is disabled when not using Interface Builder. updateViewConstraints, the method where I put the layout according to the recommendation given by the PureLayout author, is not called at all.
Just to give a bit more info about my setup:
- deleted
Main.storyboardand removed the entry from myInfo.plist - manually setup
self.windowinAppDelegate.mand addedUINavigationControllerwithMainMainControllerasrootViewController
As mentioned, my main issue is that updateViewConstraints does not get called on MainViewController but the UI elements are all displayed with the frames that I passed to them during initilization.
Note: It seems to me like I just need to enable some flag somewhere to mimic the checkbox from Interface Builder with which you can indicate whether you want to use AutoLayout.
MainViewController.m
ios - 尝试在 swift 项目中使用可可豆荚安装 Purelayout
我目前在使用 Cocoa Pods 安装 Pure Layout 时遇到问题。我设法将它安装在一个空白项目中,没有任何问题。但是当安装到我的项目中时,我不断收到以下错误:
ld:找不到框架 PureLayout clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
我已经通过堆栈溢出搜索任何可能的解决方案,并尝试将框架搜索路径添加到目标,尝试删除可可豆荚并在项目上进行全新安装。
最初在将“PureLayout”添加到 pod 文件之前,我遇到了类似的错误:
ld:找不到框架 Pod
为了解决这个问题,我从链接库和框架文件夹中删除了红色 pod 框架文件。然后建造得很好。
提前感谢任何帮助我解决这个问题的人。
下面是我的 Podfile:



