标签: programmatically

使用坐标以编程方式旋转形状

如果我有一些使用坐标数组定义的形状,例如

[[-30, -30], [-30, 30], [30, 30], [30, -30]]
Run Code Online (Sandbox Code Playgroud)

和边缘定义使用:

[[0,1],[0,3],[1,2],[2,3]]
Run Code Online (Sandbox Code Playgroud)

做一个正方形。

如何以编程方式告诉形状在javascript中以0-> 359的角度在中心旋转*?

*或者更好的是,是否有允许我选择旋转中心的功能?

** 目前,我已经设法使用以下方法将画布圈成圆形:

var x_rotate = Math.sin(angle * Math.PI /180);
var y_rotate = Math.cos(angle * Math.PI /180);

// for each coordinate
//add x_rotate and y_rotate if coordinate > 0 or subtract if coordinate < 0 
Run Code Online (Sandbox Code Playgroud)

javascript canvas rotation shapes programmatically

1
推荐指数
1
解决办法
1318
查看次数

以编程方式运行T4

我正在尝试使用T4生成代码,但无法使用Net 3.5以编程方式运行TextTemplate。

这应该所有的链接解释如何做到这一点都死了

通过保存TextTemplate生成代码文件,按预期方式工作。

c# t4 programmatically

1
推荐指数
1
解决办法
1214
查看次数

UITextView中的文本超出了它的框架Swift 3

问题是,当我在textView中输入一些文本时,文本会超出其设置的框架.我以编程方式创建所有内容.

创建UITextView:

    let descriptionTextView: UITextView = {
    let textView = UITextView()
    textView.backgroundColor = UIColor.customDarkGrayColor
    textView.text = "News Description"
    textView.textColor = UIColor.lightGray
    textView.font = UIFont.systemFont(ofSize: 15)
    textView.textContainerInset = UIEdgeInsets(top: 10, left: 16, bottom: 0, right: 16)
    textView.autocorrectionType = .no
    textView.setDefaultShadow()
    return textView
}()
Run Code Online (Sandbox Code Playgroud)

使用我的自定义方法添加为子视图和设置约束:

addSubview(descriptionTextView)

descriptionTextView.anchor(top: titleTextField.bottomAnchor, left: leftAnchor, bottom: nil, right: rightAnchor, paddingTop: 10, paddingLeft: 20, paddingBottom: 0, paddingRight: 20, width: 0, height: 80)
Run Code Online (Sandbox Code Playgroud)

检查这里的错误

user-interface uitextview ios swift programmatically

1
推荐指数
1
解决办法
1046
查看次数

曲线搜索栏 Swift 4

我在导航控制器上以编程方式更改我的搜索栏设计时遇到问题。我只想使搜索栏曲线如下图所示:

在此处输入图片说明

我在堆栈溢出中尝试了很多示例,但我仍然无法改变形状。这是现在的样子:

在此处输入图片说明

这是源代码,关于已经完成的内容:

//MARK for searchBar UI
    searchController.dimsBackgroundDuringPresentation = false
    searchController.hidesNavigationBarDuringPresentation = false
    searchController.searchBar.placeholder = " Search for programs..."
    searchController.searchBar.sizeToFit()
    searchController.searchBar.isTranslucent = false
    searchController.searchBar.backgroundImage = UIImage()
    searchController.searchBar.delegate = self
    navigationItem.titleView = searchController.searchBar
    self.searchController.searchBar.layer.cornerRadius = 20.0
    self.searchController.searchBar.clipsToBounds = true
    // SearchBar text
    let textFieldInsideUISearchBar = searchController.searchBar.value(forKey: "searchField") as? UITextField
    textFieldInsideUISearchBar?.borderStyle = .roundedRect
    textFieldInsideUISearchBar?.font = textFieldInsideUISearchBar?.font?.withSize(14)
Run Code Online (Sandbox Code Playgroud)

现在,我真的不知道如何更改它,提前致谢。

uisearchbar uinavigationitem swift uisearchcontroller programmatically

1
推荐指数
1
解决办法
1551
查看次数

如何以编程方式获取 AzureDevOps 中所有已完成 PullRequest 的列表?

我正在使用以下代码获取VSTS 存储库上所有已完成的拉取请求的列表。但是,获取的拉取请求列表仅包含有限的拉取请求列表,而不是全部。知道我做错了什么吗?

这是代码:

        /// <summary>
        /// Gets all the completed pull requests that are created by the given identity, for the given repository
        /// </summary>
        /// <param name="gitHttpClient">GitHttpClient that is created for accessing vsts.</param>
        /// <param name="repositoryId">The unique identifier of the repository</param>
        /// <param name="identity">The vsts Identity of a user on Vsts</param>
        /// <returns></returns>
        public static List<GitPullRequest> GetAllCompletedPullRequests(
            GitHttpClient gitHttpClient, Guid repositoryId, Identity identity)
        {
            var pullRequestSearchCriteria = new GitPullRequestSearchCriteria
            {
                Status = PullRequestStatus.Completed,
                CreatorId = identity.Id,
            }; …
Run Code Online (Sandbox Code Playgroud)

c# pull-request azure-devops programmatically

1
推荐指数
1
解决办法
851
查看次数

添加启动屏幕图像,而不是使用iOS的LaunchScreens.storyboard

我正在以编程方式为我的iOS应用程序执行UI。剩下的唯一事情是LaunchScreen.storyboard我还没有找到使用它的方法。奇怪的是,我在互联网上找不到很多有关它的信息。

有没有办法摆脱它,而是使用AssetSet?

LaunchScreen.storyboard

那是我要摆脱的(突出显示的文件)

xcode ios swift launch-screen programmatically

-3
推荐指数
1
解决办法
4335
查看次数