小编cdu*_*dub的帖子

CasperJS和警报框

如何测试我的页面上的警告框被调用?我可以抓住警报框的文本并进行评估吗?

我在CasperJS中的点击是这样完成的:

casper.waitForSelector('a[href="javascript:UserLogin()"]',
    function success() {
        this.test.comment("Submiting the bad login info");
        this.test.assertExists('a[href="javascript:UserLogin()"]');
        this.click("a#h_login");
    },
    function fail() {
        this.test.assertExists('a[href="javascript:UserLogin()"]');
});
Run Code Online (Sandbox Code Playgroud)

UserLogin函数检查,在这种情况下,返回:

alert('Login has failed.');
Run Code Online (Sandbox Code Playgroud)

我该如何检查?

javascript testing tdd phantomjs casperjs

5
推荐指数
2
解决办法
5224
查看次数

UITextfield borderColor和文本字段一侧的宽度

我有一个文本字段设置如下:

textField.borderStyle = UITextBorderStyleLine;
textField.layer.borderColor = [[UIColor greenColor] CGColor];
textField.layer.borderWidth= 10.0f;'
Run Code Online (Sandbox Code Playgroud)

但是左侧可能只有一个更大的边框,它是不同的颜色?或者我是否必须使用我想要的颜色和位置来定位drawRect?

uitextfield formborderstyle ios ios7

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

在iOS 7中用字母绘制实心圆圈

新的ios 7手机应用程序有一个收藏夹部分.在该部分中,联系人的姓名显示在填充的圆圈旁边,圆圈内的联系人的初始值.

这是怎么画的?使用drawrect还是已经为此创建了对象?

core-graphics drawrect ios ios7

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

使用带有LINQ的JSON.NET计算我的JSON文件中的子节点数

我有一个xml:

string xml = "<?xml .... />" +
    "<root>" +
        "<paramFile version=1.0>" +
            "<stuff />" +
        "</paramFile>" +
        "<paramFile version=1.0>" +
            "<stuff />" +
        "</paramFile>" +
     "</root>";
Run Code Online (Sandbox Code Playgroud)

然后我转换为JSON并解析它:

    XmlDocument doc = new XmlDocument();
    doc.LoadXml(xml);
    string jsonText = JsonConvert.SerializeXmlNode(doc).Replace("\"@", "\"");
    JToken token = JObject.Parse(jsonText);
Run Code Online (Sandbox Code Playgroud)

如何获取JSON中paramFiles的数量?

.net c# linq json json.net

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

将click事件添加到ios NSString中的某些文本

我有以下代码,并希望使我的文本的一部分可以点击并调用另一个UIViewController(而不是一个网站).

NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"testing it out @clickhere"];
NSInteger length = str.length;
[str addAttribute:NSForegroundColorAttributeName value:[UIColor bestTextColor] range:NSMakeRange(0,length)];
Run Code Online (Sandbox Code Playgroud)

NSMutableAttributedString设置为UILabel,如下所示:

label.attributedText = str;
Run Code Online (Sandbox Code Playgroud)

什么是最好的方法呢?我似乎无法找到一个好的答案.

我想要的一个例子是假设我有一个UILabel,如下所示:

This is my label.  Click here to go to UIViewController1 and then go to UIViewController1 by this #tag.
Run Code Online (Sandbox Code Playgroud)

我希望第一次单击事件传递"here"文本,并将"#tag"一词传递给同一个click事件.

iphone uibutton nsattributedstring ios uitapgesturerecognizer

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

在UITextView中单击NSURL

我有一个UITextView横跨我的100.0分UIView.

UITextView,我有链接,使用以下函数捕获:

- (BOOL) textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
Run Code Online (Sandbox Code Playgroud)

这非常适合捕获某些字符,但我有一个问题:如果链接是文本视图中的最后一个字符,那么点击将一直按到该行.

因此,如果我的文本视图中包含以下文本,其中@test是链接:

// The entire remainder of the line will be the link (all the white space after @test)
Hello @test
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

objective-c nsurl uitextview ios ios9

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

使用Objective C从AWS上的IOS SDK访问DynamoDB

我使用了Lamdba并设置了IAM和Cognito并获得了identityId和token.我对下一步感到困惑.登录后,用户在Cognito中进行身份验证.但是,如何通过在应用加载时刷新令牌来保持登录状态?如何仅使用经过身份验证的用户查询DynamoDB?文件含糊不清.还使用了用lambda编写的联合身份和我自己的OpenID开发人员身份验证过程.

objective-c amazon-web-services ios amazon-dynamodb aws-cognito

5
推荐指数
0
解决办法
119
查看次数

使用Amazon Cognito开发者身份

我正在关注亚马逊文档,但它不像宣传的那样工作.我也有最新的sdk.self.identity =下面的代码不起作用,因为它是只读的.

@implementation DeveloperAuthenticatedIdentityProvider
/*
 * Use the token method to communicate with your backend to get an
 * identityId and token.
 */

- (AWSTask <NSString*>) token {
    //Write code to call your backend:
    //Pass username/password to backend or some sort of token to authenticate user
    //If successful, from backend call getOpenIdTokenForDeveloperIdentity with logins map 
    //containing "your.provider.name":"enduser.username"
    //Return the identity id and token to client
    //You can use AWSTaskCompletionSource to do this asynchronously

    // Set the identity id and return …
Run Code Online (Sandbox Code Playgroud)

objective-c amazon-web-services ios amazon-cognito aws-sdk-ios

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

将AWS Cognito和aws-ios-sdk v.2.4.16与开发人员身份一起使用

我设置了一组lambda函数来完成我的所有身份验证.我通过api网关从我的应用程序连接,然后最终调用GetOpenIdTokenForDeveloperIdentity().这会通过网关将identityId和token返回给我的设备.

接下来,我按照本网站的说明(针对Objective-C):http: //docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html

因为我有identityId和令牌,所以我从这开始:

DeveloperProvider.h

#import <AWSCore/AWSCore.h>

@interface DeveloperProvider : AWSCognitoCredentialsProviderHelper

@end
Run Code Online (Sandbox Code Playgroud)

DeveloperProvider.m

@implementation DeveloperProvider
/*
 * Use the token method to communicate with your backend to get an
 * identityId and token.
 */

// Below gave me an error and changed to: - (AWSTask <NSString *> *) token
- (AWSTask <NSString*>) token
{
    //Write code to call your backend:
    //Pass username/password to backend or some sort of token to authenticate user
    //If successful, from backend call getOpenIdTokenForDeveloperIdentity …
Run Code Online (Sandbox Code Playgroud)

objective-c amazon-web-services ios amazon-cognito aws-sdk-ios

5
推荐指数
0
解决办法
221
查看次数

使用 Flex CSS 和 Bootstrap 实现响应式布局

我一直在尝试台式机、平板电脑和手机尺寸之间的完全响应式布局,但我在使用下面的布局时遇到了问题。

我使用的是引导程序中的网格布局,但由于它是两列,随着宽度缩小,第二列位于左侧主要内容部分下方。我想将其拆分为屏幕下方的状态。

这是起始视图:

在此输入图像描述

这就是我想要发生的事情:

在此输入图像描述

这是手机视图:

在此输入图像描述

因此,宽视图在测试过程中会缩小,我希望它跳转到移动视图,其中顶部侧边栏位于主要内容上方并与主要内容的宽度匹配,而底部侧边栏对底部执行相同的操作。

将两个侧边栏放在底部很容易,但我想尝试找出将其拆分的可能性。

为了进行测试,我使用了 flexbox、css3 和 bootstrap5+,没有插件或 javascript。

css flexbox twitter-bootstrap bootstrap-5

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