文本在容器中无法正常显示(swift 3.0)

时间:2017-04-15 19:50:11

标签: ios swift xcode nslayoutconstraint

我有一个UIlabel,我想调整文本对齐,以便在没有足够的文本填充视图框时。我已经包含了两个屏幕截图,以便更好地说明我正在努力实现的目标。

First Image

注意文本是如何放在中间的。

Second Image

注意文本现在如何从左上角开始

有什么建议吗?

2 个答案:

答案 0 :(得分:0)

然后设置UILabel约束,锚定到容器的顶部和左侧。

     yourLabel.translatesAutoresizingMasks = false

别忘了设置

spark-submit \ 
--driver-java-options "-XX:PermSize=1024M -XX:MaxPermSize=3072M" \ 
--driver-memory 3G  \ 
--class com.program.classname \ 
--master yarn \ 
--deploy-mode cluster \ 
--proxy-user hdfs \ 
--executor-memory 5G \ 
--executor-cores 3 \ 
--num-executors 6 \ 
--conf spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version=2 \ 
--conf spark.yarn.executor.memoryOverhead=2900 \
--conf spark.dynamicAllocation.enabled=true \ 
--conf spark.dynamicAllocation.initialExecutors=10 \ 
--conf spark.dynamicAllocation.maxExecutors=20 \ 
--conf spark.speculation=false \ 
--conf spark.dynamicAllocation.minExecutors=6 \ 
--conf spark.sql.shuffle.partitions=6 \ 

--conf spark.network.timeout=10000000 \ 
--conf spark.executor.heartbeatInterval=10000000 \ 
--conf spark.yarn.driver.memoryOverhead=4048 \ 
--conf spark.driver.cores=3 \ 
--conf spark.shuffle.memoryFraction=0.5 \ 
--conf spark.storage.memoryFraction=0.5 \ 
--conf spark.core.connection.ack.wait.timeout=300  \ 
--conf spark.shuffle.service.enabled=true \ 
--conf spark.shuffle.service.port=7337 \ 
--queue spark \ 

在设置约束之前

答案 1 :(得分:0)

您可以使用urLabel.sizeToFit()

1.设置你想要的宽度。

2.根据内容调整高度。