自动布局,尽管它是好的,让我疯狂的约束.我有在IB设计的肖像模式,但我无法获得所需的横向方向.

请注意,当方向更改为横向时,UIImageView块之间的间距会减小,并且SAMPLE TEXT更改的文本对齐方式会右对齐.
目前,我已经为它添加了一些限制.但是,我需要保持UIImageView块之间的空间固定,因此它看起来像肖像和景观中的精细.我需要将它均匀地分布在肖像中并在景观中压缩(如上图所示).同样,目前我的约束会调出文本,但它不会将其保持在屏幕的中心并且右对齐.
自动布局可以实现这一点吗?如果是这样,怎么样?非常感谢.
我有一个基于核心数据的应用程序,它使用Dropbox备份和恢复数据.我备份的方式非常简单.我复制用户的保管箱上的.sqlite文件.
现在我的备份和恢复功能正常.问题出在.sqlite文件本身.看来.sqlite文件不完整.
我在我的应用程序中输入了大约125个条目并进行了备份.备份出现在我的Dropbox中但是当我使用.sqlite资源管理器工具查看内容时,我只看到第117个记录的记录.
我尝试更新第一个条目,然后再次观察.sqlite文件,但没有再次更改.
更奇怪的是该应用程序似乎记录了所有更改.当我添加新条目或更新现有条目并重新启动应用程序时,新添加的数据似乎仍然存在.但是这个新添加的数据不会出现在我的.sqlite文件中.
我正在使用此代码备份:
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSString *filePath = [[[appDelegate applicationDocumentsDirectory] path] stringByAppendingPathComponent:@"MyApp.sqlite"];
if (account) {
if ([filesystem isShutDown]) {
filesystem = [[DBFilesystem alloc] initWithAccount:account];
[DBFilesystem setSharedFilesystem:filesystem];
}
DBPath *newPath = [[DBPath root] childPath:[NSString stringWithFormat:@"Backup - %@.sqlite", [NSDate date]]];
DBFile *file = [[DBFilesystem sharedFilesystem] createFile:newPath error:nil];
[file writeContentsOfFile:filePath shouldSteal:NO error:nil];
[filesystem shutDown];
}
Run Code Online (Sandbox Code Playgroud)
我还从Simulator的文件夹中复制了.sqlite文件,并尝试在.sqlite浏览器中查看它.它仍然表现出相同的行为.有必要发生这种情况的原因吗?
我正在使用PDFMake(一种变体PDFKit)使用实时数据库触发器在Firebase云功能上生成PDF.该函数从数据库获取所有相关数据,然后将其传递给应该生成PDF的函数.
所有这些都是使用Promises完成的.一切正常,直到实际生成PDF.
这是我的主要事件监听器中的代码:
exports.handler = (admin, event, storage) => {
const quotationData = event.data.val();
// We must return a Promise when performing async tasks inside Functions
// Eg: Writing to realtime db
const companyId = event.params.companyId;
settings.getCompanyProfile(admin, companyId)
.then((profile) => {
return quotPdfHelper.generatePDF(fonts, profile, quotationData, storage);
})
.then(() => {
console.log('Generation Successful. Pass for email');
})
.catch((err) => {
console.log(`Error: ${err}`);
});
};
Run Code Online (Sandbox Code Playgroud)
要生成PDF,这是我的代码:
exports.generatePDF = (fonts, companyInfo, quotationData, storage) => {
const printer = new PdfPrinter(fonts);
const …Run Code Online (Sandbox Code Playgroud) 我正在使用添加视图作为子视图[self.view addSubview:myView].这在纵向模式下工作正常.但是,它在景观中根本不起作用.如何以编程方式添加布局约束?
我的视图目前看起来像是纵向矩形,我需要它在横向模式下看起来像横向矩形.
我尝试使用此代码来查看代码中的约束如何工作,但它总是导致异常.代码是:
[self.view addSubview:_preView];
NSLayoutConstraint *myConstraint = [NSLayoutConstraint
constraintWithItem:_preView
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.view.superview
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:-239];
[_preView addConstraint:myConstraint];
Run Code Online (Sandbox Code Playgroud)
这总是会导致异常.我知道上面的代码只是试图确保预览的底部高于主视图底部239px.但这也不起作用.
你可以帮我解决这个问题,以便我能解决景观问题吗?
UPDATE
生成的异常是:
2013-08-05 16:13:28.889 Sample Code[33553:c07] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal. constraint:<NSLayoutConstraint:0x912c430 UIView:0x8561340.bottom == UILayoutContainerView:0x8257340.bottom - 20> view:<UIView: 0x85774e0; frame = (0 0; 320 568); opaque = NO; autoresize = W+H; autoresizesSubviews = …
我试图在SceneKit周围学习,作为一个例子,我想我会尝试使用SDK构建一个太阳能系统.我能够添加SCNode对象并配置其材质属性,如图案和光照.此外,我能够旋转行星,但我似乎无法理解如何沿着特定的路径"旋转"它们.
到目前为止我的代码看起来像:
// create a new scene
SCNScene *scene = [SCNScene scene];
// create and add a camera to the scene
SCNNode *cameraNode = [SCNNode node];
cameraNode.camera = [SCNCamera camera];
[scene.rootNode addChildNode:cameraNode];
// place the camera
cameraNode.position = SCNVector3Make(0, 0, 2);
// create and add a 3d sphere - sun to the scene
SCNNode *sphereNode = [SCNNode node];
sphereNode.geometry = [SCNSphere sphereWithRadius:0.3];
[scene.rootNode addChildNode:sphereNode];
// create and configure a material
SCNMaterial *material = [SCNMaterial material];
material.diffuse.contents = [NSImage imageNamed:@"SunTexture"];
material.specular.contents …Run Code Online (Sandbox Code Playgroud) 我正在使用Elastic Beanstalk在AWS上部署基于Django/Python构建的Web服务.我正在使用Django的日志记录功能来记录网站使用和相关数据.虽然这在本地测试中运行良好,但我无法使用Beanstalk.
我登录的代码settings.py是:
# Django Logging
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'spareguru.log',
'formatter': 'verbose'
},
},
'loggers': {
'django': {
'handlers':['file'],
'propagate': True,
'level':'DEBUG',
},
'customer': {
'handlers': ['file'],
'level': 'DEBUG',
},
}
}
Run Code Online (Sandbox Code Playgroud)
部署到Beanstalk时遇到的错误是:
ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: …Run Code Online (Sandbox Code Playgroud)