小编PPr*_*sai的帖子

如何在UIImageView上添加交互式UILabel?

我需要添加几个标签UIImageView.标签的文本可以通过点击它们来更改.实现这一目标的最佳方法是什么?我正在使用Swift编程语言.在stackoverflow上查找一些解决方案,我发现了一些使用String.drawInRect方法在矩形中绘制一些文本的演练,然后将其放置在UIImageView.但是像这样我认为我不能改变文本,甚至不能识别它们上的触摸事件.请帮忙.

UPDATE

我的代码到目前为止:

override func viewDidLoad() {
    super.viewDidLoad()
    let img = UIImage(named: "Image")
    let imgView = UIImageView(image: img)

    self.view.addSubview(imgView)

    var myLabel = UILabel()
    myLabel.text = "Hello There"
    myLabel.textColor = UIColor.redColor()
    myLabel.font = UIFont(name: "Marker Felt", size: 20)
    myLabel.accessibilityIdentifier = "this is good!"
    myLabel.frame = CGRect(x: img!.size.width/2 /* - myLable.width / 2 ? */, y: 0, width: img!.size.width, height: 40)
    imgView.addSubview(myLabel)
    imgView.userInteractionEnabled = true
    myLabel.userInteractionEnabled = true
    let tapGesture = UITapGestureRecognizer(target: self, action: "handlePanGesture:")
    myLabel.addGestureRecognizer(tapGesture) …
Run Code Online (Sandbox Code Playgroud)

interactive uiimageview uilabel ios swift

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

Phonegap覆盖软键盘上的Go键

我试图在用户按下Android软键盘上的"Go"时触发按钮上的点击事件.任何帮助将受到高度赞赏.

<div class="combined_input ui-shadow-inset">
    <input type="text" placeholder="Username" id="username" value="" data-mini="true"   class="bb_1">
    <input type="password" placeholder="Password" id="password" value="" data-mini="true">
</div>

<div data-role="none" class="login">
    <input type="button" value="Login" class="ok" id="login-btn" data-mini="true">
</div>
<div data-role="none" class="cancel">
    <input type="button" value="Cancel" class="cancel" onClick="exitApp()" data-mini="true">
</div>
Run Code Online (Sandbox Code Playgroud)

当用户输入密码并按"开始"按钮时,我想触发点击事件login-btn.可以这样做吗?

问候,

JadeSync.

overriding android-softkeyboard cordova

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

部署在Tomcat8上的Spring Boot MVC应用程序war文件因java.lang.TypeNotPresentException而失败

我用Spring Boot编写了一个REST API,并将其打包为WAR文件.我将WAR复制到Tomcat 8的webapps文件夹并启动了tomcat服务.当服务器启动时,它会抛出一些由以下原因引起的异常:

java.lang.TypeNotPresentException:输入org.springframework.test.context.ContextConfiguration不存在

我解决了这个问题并发现如果我将webapp的lib和lib提供的文件夹上的JAR文件移动到Tomcat8/lib文件夹,则不会抛出任何异常并且API按预期工作.我不知道是什么导致了这个问题.我对他pom.xml的范围有一些依赖关系provided.也许他们给我带来了问题.

这是我的pom:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.3.RELEASE</version>
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.pp</groupId>
        <artifactId>DAO-Commons</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.pp</groupId>
        <artifactId>carddao</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.pp</groupId>
        <artifactId>cardtemplatedao</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.pp</groupId>
        <artifactId>cardlibrarydao</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

spring-mvc maven tomcat8 spring-boot

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