我刚刚开始在iOS学习UI测试.当我按下记录并点击表格的第一个索引时,它会生成这样的代码.
XCUIApplication *app = [[XCUIApplication alloc] init];
[app.tables.staticTexts[@"Apr 04 16:28"] tap];
Run Code Online (Sandbox Code Playgroud)
如果我的所有数据都是恒定的,那就好了.但这些文本会不时更改.如何修改这些代码,以便始终点击表的第一个索引?
在UIViewControllerSwift 的正常情况下,我使用此代码发送邮件。
let mailComposeViewController = configuredMailComposeViewController()
mailComposeViewController.navigationItem.leftBarButtonItem?.style = .plain
mailComposeViewController.navigationItem.rightBarButtonItem?.style = .plain
mailComposeViewController.navigationBar.tintColor = UIColor.white
if MFMailComposeViewController.canSendMail() {
self.present(mailComposeViewController, animated: true, completion: nil)
} else {
self.showSendMailErrorAlert()
}
Run Code Online (Sandbox Code Playgroud)
如何在SwiftUI中实现相同目标?
我需要使用UIViewControllerRepresentable吗?
在此问题中,如何强制NSLocalizedString使用特定语言
我可以通过这种方法强制本地化.
@interface NSBundle (Language)
+(void)setLanguage:(NSString*)language;
@end
Run Code Online (Sandbox Code Playgroud)
#import <objc/runtime.h>
static const char _bundle=0;
@interface BundleEx : NSBundle
@end
@implementation BundleEx
-(NSString*)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName
{
NSBundle* bundle=objc_getAssociatedObject(self, &_bundle);
return bundle ? [bundle localizedStringForKey:key value:value table:tableName] : [super localizedStringForKey:key value:value table:tableName];
}
@end
@implementation NSBundle (Language)
+(void)setLanguage:(NSString*)language
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
object_setClass([NSBundle mainBundle],[BundleEx class]);
});
objc_setAssociatedObject([NSBundle mainBundle], &_bundle, language ? [NSBundle bundleWithPath: [[NSBundle mainBundle] pathForResource:language ofType:@"lproj"]] : nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
@end
Run Code Online (Sandbox Code Playgroud)
在那之后,我需要本地化图像,因此,我喜欢这样. 本地化资产目录 …
我刚开始学习ARKitexample和Scenekit.我读了一些Scenekit,发现为了添加文本,我需要使用SCNText.
我试着像这样写,但它没有表现出来.
guard let pointOfView = sceneView.pointOfView else { return }
let text = SCNText(string: "Hello", extrusionDepth: 4)
let textNode = SCNNode(geometry: text)
textNode.geometry = text
textNode.position = SCNVector3Make(pointOfView.position.x, pointOfView.position.y, pointOfView.position.z)
sceneView.scene.rootNode.addChildNode(textNode)
Run Code Online (Sandbox Code Playgroud)
我只想在用户按下按钮时在SCNScene上添加一些文本(如"hello world").
编辑
我看到那个文字,但由于我没有设置平面(或锚),我不能把它看作好像我在那个文本前面.我能怎么做?
我是Firebase的新手,正在做聊天应用程序。
在我的Firebase控制台中,我可以看到这样的原始数据。由于这是私人信息,我可以隐藏一些(或全部)信息吗?
如果我无法隐藏,则对“文本”使用了加密。因此,在我的移动设备中,我进行了加密和解密。还是可以的 问题是我无法搜索/查询文本,因为它已在服务器中加密。我该怎么办?
如果我只能在firebase控制台中隐藏数据,则无需进行加密等操作。目的是防止开发人员(如我)看到用户数据。
我们可以在viewdidload中创建像此代码一样的自定义键盘,如Apple开发者网站所示.
self.nextKeyboardButton = [UIButton buttonWithType:UIButtonTypeSystem];
[self.nextKeyboardButton setTitle:NSLocalizedString(@"Next Keyboard", @"Title for 'Next Keyboard' button") forState:UIControlStateNormal];
[self.nextKeyboardButton sizeToFit];
self.nextKeyboardButton.translatesAutoresizingMaskIntoConstraints = NO;
[self.nextKeyboardButton addTarget:self action:@selector(advanceToNextInputMode) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.nextKeyboardButton];
NSLayoutConstraint *nextKeyboardButtonLeftSideConstraint = [NSLayoutConstraint constraintWithItem:self.nextKeyboardButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0];
NSLayoutConstraint *nextKeyboardButtonBottomConstraint = [NSLayoutConstraint constraintWithItem:self.nextKeyboardButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0];
[self.view addConstraints:@[nextKeyboardButtonLeftSideConstraint, nextKeyboardButtonBottomConstraint]];
Run Code Online (Sandbox Code Playgroud)
但是,有1个问题.当我们以纵向运行该程序时,自定义键盘的高度约为220.然后我们改为横向.它小于220.奇怪的是,当我回到纵向视图时,高度不再是220,它与景观高度相同.它永远不会回到原来的高度.那么,有没有办法改变我们将添加子视图的视图高度?
目前,我在 1 个文件中编写测试(默认)。是否可以有多个文件并进行测试?
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
XCTAssert(YES, @"Pass");
}
Run Code Online (Sandbox Code Playgroud) 我已经读完了这两个.
Xcode7 | Xcode UI测试| 如何处理位置服务警报?
我能知道以下情况吗?
1)对于位置,放置"位置对话框"表示它将处理位置提示.它如何识别?
2)如何处理访问图库或相机的系统提示?是否有任何处理程序描述列表?
目前,在我们公司,我们只是将所有 pod(如 AFNetworking、Realm 等)提交到 svn/git。时不时有其他开发者安装pod、更新pod时,会发生冲突。
我们也使用它,这样我们就不会接触其他豆荚。
pod install --no-repo-update
Run Code Online (Sandbox Code Playgroud)
我可以知道使用第三方 Pod 的最佳做法是什么吗?我需要提交那些豆荚吗?
或者只是在我们的代码被检出后再次安装 pod ?我只是想避免使用 pod 的代码冲突。
ios ×6
xcode ×2
3dtouch ×1
arkit ×1
autolayout ×1
cocoapods ×1
firebase ×1
image ×1
ios8 ×1
ios9 ×1
iphone ×1
keyboard ×1
localization ×1
messageui ×1
mfmailcomposeviewcontroller ×1
objective-c ×1
scenekit ×1
swift ×1
swiftui ×1
xctest ×1