在Swift中,要将水印对齐而不是右对齐

时间:2017-05-19 20:51:57

标签: ios swift uiimage

我购买了一个应用程序模板,我需要一些帮助。该应用程序包含的图像,当发送到共享页面时,会覆盖水印。开发人员选择将此水印放在右下角,但我需要在左下方。你能帮我把它移到那个位置吗?以下是控制水印的代码部分:

...
// waiting for first iframe to be visible
        browser.wait(EC.visibilityOf(page.firstIframe),10000).then(function() {

            // switch to first iframe
            browser.driver.switchTo().frame(page.firstIframe.getWebElement());

            // verify content is displayed
            expect(page.content.isDisplayed()).toBeTruthy();
        });

        // waiting for second iframe to be visible
        browser.wait(EC.visibilityOf(page.secondIframe),10000).then(function() {

            // switch to second iframe
            browser.driver.switchTo().frame(page.secondIframe.getWebElement());

            // waiting for modal to be visible
            browser.wait(EC.visibilityOf(page.modalUnit),10000).then(function() {
...

1 个答案:

答案 0 :(得分:0)

这应该有效:

guard let watermark = UIImage(named: "watermark") else { return}
UIGraphicsBeginImageContextWithOptions(originalImage.size, true, originalImage.scale)
drawingImageView.image?.draw(at: .zero)
let posX = 0
let posY = originalImage.size.height - watermark.size.height
watermark.draw(at: CGPoint(x: posX, y: posY))
drawingImageView.image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

只需更改" posX"为了让水印从屏幕左侧开始,为零。