你能告诉我,在UITableview上滑动单元格时如何添加自定义图像来删除按钮?
我在Java + Spring中不是很好,但我想Cache-Control在我的头文件中添加标题ResponseEntity.
@RequestMapping(value = "/data/{id}", method = GET")
public ResponseEntity<String> getData(@PathVariable("id") String id) {
try {
...
HttpHeaders headers = new HttpHeaders();
headers.setCacheControl("max-age=600");
return new ResponseEntity<String>(body, headers, HttpStatus.OK);
}
}
Run Code Online (Sandbox Code Playgroud)
我添加了两行代码HttpHeaders,现在Cache-Control我的响应中有两个标题:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
Cache-Control: max-age=600
Content-Type: application/json;charset=UTF-8
Content-Length: 18223
Date: Wed, 29 Jun 2016 21:56:57 GMT
Run Code Online (Sandbox Code Playgroud)
我做错了什么?有人能帮助我吗?
我以前使用物镜C的Lumberjack记录器,我喜欢它.现在我开始学习Swift,我不能在那里使用我最喜欢的记录器.有人可以一步一步地写出我能做到的事吗?在Lumberjack 2.0发布之前,我尝试在这里找到一些东西,但所有主题都是自定义包装器.我做了什么:
我不知道接下来该怎么办?因为在ObjC中我有宏:static const int ddLogLevel = LOG_LEVEL_INFO; else static const int ddLogLevel = LOG_LEVEL_VERBOSE; 我的日志级别取决于编译标志......我可以在这里做吗?以及如何在代码中使用Lumberjack?谢谢!
我有UIViewController通过UISearchBarDelegate。并通过以下方式将其委托设置为self:resultSearchController.searchBar.delegate = self。我用searchBarCancelButtonClicked方法进行了测试,效果很好
func searchBarCancelButtonClicked(searchBar: UISearchBar) {
println("?ancel button tapped")
}
Run Code Online (Sandbox Code Playgroud)
我在控制台中看到“轻按了ancel按钮”。但是我想更改“取消”按钮的标题,我不知道如何。我尝试过:
func searchBarTextDidBeginEditing(searchBar: UISearchBar) {
var barButton = UIBarButtonItem(title: "Button Title", style: UIBarButtonItemStyle.Done, target: self, action: "here")
self.resultSearchController.searchBar.showsCancelButton = false
self.resultSearchController.navigationItem.rightBarButtonItem = barButton
}
Run Code Online (Sandbox Code Playgroud)
但这是行不通的。请问你能帮帮我吗?
我正在尝试学习Spring Boot.但我完全陷入了记录器依赖关系.我有一个简单的pom:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
我在..src\main\resources \中创建了log4j2.xml
我用这样的东西记录:
private static final Logger LOG = LoggerFactory.getLogger(MyClass.class);
LOG.error("ERRRRRRR!!!!");
Run Code Online (Sandbox Code Playgroud)
但当应用程序启动时,我看到:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.3/log4j-slf4j-impl-2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Run Code Online (Sandbox Code Playgroud)
当然log4j2及其配置不起作用.
我知道,这是一个流行的问题.我搜索了很多答案,但对我来说没什么用.
我正在写Spring应用程序,我有两个外部罐子.它在IDE中工作,但是当我用maven构建可执行jar时,它失败了,错误java.lang.NoClassDefFoundError:到我的外部jar.我用Google搜索,但我仍然不知道该怎么做.请帮我.我对pom文件的依赖是:
<dependency>
<groupId>com.myapp.myappawsprovider</groupId>
<artifactId>MyAppProvider</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>/Users/Projects/Java/MyApp/MyAppProvider/target/MyAppProvider Provider-1.0.0.jar</systemPath>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我用男士包装来构建它.
我绝对打破了我的脑袋.我有代码,用于发送iOS的SNS(AWS):
PublishRequest publishRequest = new PublishRequest("arn:aws:sns:us-east-1:my:topic", messageBody);
Run Code Online (Sandbox Code Playgroud)
当我像这样经过Json时,它工作正常:
{"message": "ldjldkjlk"}
Run Code Online (Sandbox Code Playgroud)
但我当然需要声音通知我,没有什么对我有用.我尝试使用Json,当我将它传递给SNS GUI时,它就是这样的:
{"message": {
"default": "HERE IS AN ALERT, BADGE, and SOUND",
"APNS_SANDBOX": "{\"aps\": {\"alert\":\"HERE IS AN ALERT, BADGE, and SOUND!\",\"badge\": 1,\"sound\":\"bingbong.aiff\"}}"
}}
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
{"timestamp":1435334944602,"status":400,"error":"Bad Request","exception":"org.springframework.http.converter.HttpMessageNotReadableException","message":"Could not read JSON: Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@2db14d22; line: 1, column: 15]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@2db14d22; line: 1, column: 15]","path":"/sns/send"}
Run Code Online (Sandbox Code Playgroud)
他们用PublishRequest做了什么?我应该通过什么?如果有人帮助我会很棒!
java amazon-web-services apple-push-notifications amazon-sns ios
我有一张桌子,它运作良好。但是我必须在背景上添加渐变。我用viewDidLoad中的这段代码做到了:
gradientLayer.frame = self.view.bounds
let color1 = UIColor.blueColor().CGColor as CGColorRef
let color2 = UIColor.redColor().CGColor as CGColorRef
gradientLayer.colors = [color1, color2]
gradientLayer.locations = [0.0, 1.0]
gradientLayer.startPoint = CGPoint(x: 1, y: 0)
gradientLayer.endPoint = CGPoint(x: 0, y: 0)
self.view.layer.addSublayer(gradientLayer)
self.view.backgroundColor = UIColor.greenColor()
Run Code Online (Sandbox Code Playgroud)
但是现在我看不到表视图的任何内容。
有人可以帮帮我吗?
我想构建一个包并将其安装到我的本地仓库.我的pom文件是:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.me</groupId>
<artifactId>MyApp</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<!-- This block declare a dependencies for this project -->
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<!-- This block declare a plugins -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
</plugin>
<!-- Installing to local repo -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<groupId>com.me</groupId> …Run Code Online (Sandbox Code Playgroud) java ×5
ios ×4
swift ×4
maven ×3
spring ×3
logging ×2
uitableview ×2
amazon-sns ×1
custom-cell ×1
jar ×1
log4j2 ×1
lumberjack ×1
spring-boot ×1
spring-mvc ×1
uisearchbar ×1
uiview ×1