首页 > 其他分享 >SwiftUI Text 文字处理

SwiftUI Text 文字处理

时间:2024-05-06 20:34:16浏览次数:23  
标签:ContentView 文字处理 Text SwiftUI text 字体

代码


//
//  ContentView.swift
//  SwiftUIText
//
//  Created by CHEN Hao on 2024/5/6.
//

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack{
            Text("Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma—which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition.")
                .fontWeight(.bold) // 字体粗细
                .font(.custom("Poppins", size: 25)) // 字体样式&字体大小
                .foregroundStyle(.gray) // 字体背景色
                .multilineTextAlignment(.center) // 多行文字对齐方式
                .lineLimit(nil) // 多行文字限制行数
                .truncationMode(.head) // 截断模式
                .lineSpacing(10.0) // 行距
                .padding() // 外边距
                .rotation3DEffect(
                    .degrees(60),
                                          axis: (x: 0.1, y: 0.0, z: 0.0)
                ) // 文字3D效果
                .shadow(color: .gray, radius: 2,x: 0,y: 15) // 阴影
            
            // MARK: Markdown语法
            Text("**This is how you bold a text**. *This is how you make text italic.* You can [click this link](https://www.appcoda.com) to go to appcoda.com")
                .font(.title)
        }
        
    }
}

#Preview {
    ContentView()
}

效果

标签:ContentView,文字处理,Text,SwiftUI,text,字体
From: https://www.cnblogs.com/thankcat/p/18175826

相关文章

  • Text Representation
    1StatisticalModel1.1One-Hot1.2Bagofwords(BOW)https://web.stanford.edu/class/datasci112/lectures/lecture8.pdf1.3N-grams1.4TF-IDF2WordEmbedding(NeuralNetworkModel)2.1Word2Vechttps://projector.tensorflow.org/ContinuousBagofWords(CBOW......
  • applicationContext.xml
    我真服了,搜了半天没有我想看见的就是关于取代mybatis.xml的文件只能自己写一个了并不能完全取代,至少日志部分还得保留1<?xmlversion="1.0"encoding="UTF-8"?>2<beansxmlns="http://www.springframework.org/schema/beans"3xmlns:xsi="http://www.w3.org/2......
  • WPF Text MultiBinding StringFormat
    <TextBlock.Text><MultiBindingStringFormat="R:{0:N0},G:{1:N0},B:{2:N0}"><BindingPath="Value"ElementName="_red"/><BindingPath="Value"ElementName="_green"/>......
  • WPF DataContext="{Binding SelectedItem,ElementName=_master}"
    <Windowx:Class="WpfApp80.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.......
  • Servlet中的Config和Context
    ServletConfig在servlet对象创建之后创建,每有一个servlet对象就有对应的servletConfig对象。ServletContext在Tomcat服务器加载Web项目后由Tomcat创建,一个web项目在Tomcat的启动运行中只有一个Context对象。ServletContext对象:ServletContext是一个全局对象,代表整个Web应......
  • TextMeshPro - 基本使用
    1 选中字体文件(这边使用了华文行楷),然后创建FontAsset创建后会生成一个TMP用的字体资源 2,创建一个TextMeshPro的Text将字体资源设置为刚刚创建的那个,就可以开始使用了 3,粗体,斜体,下划线,删除线,文字颜色设置  4,字符间距,单词间距,行间距,段落间距的控制 5, 文字......
  • TextMeshPro - 和UGUI Text的简单对比
    已经有uguiText了,为什么还要再来个TextMeshPro?1)TextMeshPro使用了更先进的渲染技术,渲染效果更好。同样的36号斜体字在Scene窗口中,我们放大后,Text可以明显的看到锯齿,而TextMeshPro字体的边缘还是圆润光滑。2)TextMeshPro默认支持多种渐变效果3) 性能更好的描边(TextMes......
  • 【发现一个小问题】golang http client: 配置了Client 对象的 Timeout 就会导致 conte
    作者:张富春(ahfuzhang),转载时请注明作者和引用链接,谢谢!cnblogs博客zhihuGithub公众号:一本正经的瞎扯我这样初始化了客户端:varclient=http.Client{Timeout:time.Duration(1000)*time.Millisecond,}然后在request创建过程中使用了context的timeout机制:tim......
  • android更改EditText下划线颜色
    在res——》values——》themes中添加下列代码<stylename="editTextStyle"><!--选中时下划线的颜色--><itemname="colorControlActivated">@color/gray1</item><!--默认时下划线的颜色--><itemname="colorControlNormal"&......
  • 如何用Sublime Text实现正则查找与替换
    比如将下面的汉字语义加上中括号[{"text":"微笑","path":"emot01.png"},{"text":"大笑","path":"emot02.png"},{"text":"鼓掌","......