如何测试我的页面上的警告框被调用?我可以抓住警报框的文本并进行评估吗?
我在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)
我该如何检查?
我有一个文本字段设置如下:
textField.borderStyle = UITextBorderStyleLine;
textField.layer.borderColor = [[UIColor greenColor] CGColor];
textField.layer.borderWidth= 10.0f;'
Run Code Online (Sandbox Code Playgroud)
但是左侧可能只有一个更大的边框,它是不同的颜色?或者我是否必须使用我想要的颜色和位置来定位drawRect?
新的ios 7手机应用程序有一个收藏夹部分.在该部分中,联系人的姓名显示在填充的圆圈旁边,圆圈内的联系人的初始值.
这是怎么画的?使用drawrect还是已经为此创建了对象?
我有一个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的数量?
我有以下代码,并希望使我的文本的一部分可以点击并调用另一个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
我有一个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)
我该如何解决?
我使用了Lamdba并设置了IAM和Cognito并获得了identityId和token.我对下一步感到困惑.登录后,用户在Cognito中进行身份验证.但是,如何通过在应用加载时刷新令牌来保持登录状态?如何仅使用经过身份验证的用户查询DynamoDB?文件含糊不清.还使用了用lambda编写的联合身份和我自己的OpenID开发人员身份验证过程.
objective-c amazon-web-services ios amazon-dynamodb aws-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
我设置了一组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
我一直在尝试台式机、平板电脑和手机尺寸之间的完全响应式布局,但我在使用下面的布局时遇到了问题。
我使用的是引导程序中的网格布局,但由于它是两列,随着宽度缩小,第二列位于左侧主要内容部分下方。我想将其拆分为屏幕下方的状态。
这是起始视图:
这就是我想要发生的事情:
这是手机视图:
因此,宽视图在测试过程中会缩小,我希望它跳转到移动视图,其中顶部侧边栏位于主要内容上方并与主要内容的宽度匹配,而底部侧边栏对底部执行相同的操作。
将两个侧边栏放在底部很容易,但我想尝试找出将其拆分的可能性。
为了进行测试,我使用了 flexbox、css3 和 bootstrap5+,没有插件或 javascript。
ios ×7
objective-c ×4
aws-sdk-ios ×2
ios7 ×2
.net ×1
aws-cognito ×1
bootstrap-5 ×1
c# ×1
casperjs ×1
css ×1
drawrect ×1
flexbox ×1
ios9 ×1
iphone ×1
javascript ×1
json ×1
json.net ×1
linq ×1
nsurl ×1
phantomjs ×1
tdd ×1
testing ×1
uibutton ×1
uitextfield ×1
uitextview ×1